Skip to content

Commit bd67014

Browse files
authored
Merge pull request #25 from shiftonetothree/CI-test
Improve test case stability in GitHub action
2 parents 0bada4a + 56e52e0 commit bd67014

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

test/features/stability.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ import { testEachModel } from "../env";
22
import { createModel } from "../utils";
33
import { makeTestSound } from "../make-test-sound";
44

5+
const times = 500;
6+
57
testEachModel(
6-
"speak 1000 times",
8+
`speak ${times} times`,
79
async ({ app, model: { modelJsonWithUrl, hitTests } }) => {
810
const model = await createModel(modelJsonWithUrl);
911
model.update(100);
1012
app.stage.addChild(model);
1113
app.renderer.resize(model.width, model.height);
1214
app.render();
13-
for (let i = 0; i < 1000; i++) {
15+
for (let i = 0; i < times; i++) {
1416
await new Promise<void>((resolve, reject) => {
1517
const duration = Math.random() * 0.01;
1618
model.speak(makeTestSound(undefined, 0.1, duration), {

vite.config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export default defineConfig(({ command, mode }) => {
100100
],
101101
test: {
102102
include: ["**/*.test.ts", "**/*.test.js"],
103+
testTimeout: 10 * 1000,
103104
browser: {
104105
enabled: true,
105106
name: "chrome",
@@ -120,6 +121,18 @@ export default defineConfig(({ command, mode }) => {
120121
override async sort(files: Parameters<BaseSequencer["sort"]>[0]) {
121122
files = await super.sort(files);
122123

124+
// stability tests are slow, it will drag others leg behind
125+
// so we put them at the last
126+
const stabilityTestFiles: typeof files = [];
127+
128+
files = files.filter(([project, file]) => {
129+
if (file.includes("stability")) {
130+
stabilityTestFiles.push([project, file]);
131+
return false;
132+
}
133+
return true;
134+
});
135+
123136
const bundleTestFiles: typeof files = [];
124137

125138
files = files.filter(([project, file]) => {
@@ -130,7 +143,7 @@ export default defineConfig(({ command, mode }) => {
130143
return true;
131144
});
132145

133-
return [...files, ...bundleTestFiles];
146+
return [...files, ...stabilityTestFiles];
134147
}
135148
},
136149
},

0 commit comments

Comments
 (0)