-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
/
test-runner-build.ts
35 lines (33 loc) · 854 Bytes
/
test-runner-build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type { Task } from '../task';
import { exec } from '../utils/exec';
import { PORT } from './serve';
export const testRunnerBuild: Task & { port: number } = {
description: 'Run the test runner against a built sandbox',
junit: true,
dependsOn: ['serve'],
port: PORT,
async ready() {
return false;
},
async run({ sandboxDir, junitFilename }, { dryRun, debug }) {
const execOptions = { cwd: sandboxDir };
const flags = [
`--url http://127.0.0.1:${this.port}`,
'--junit',
'--maxWorkers=2',
'--failOnConsole',
'--skipTags="test-skip"',
];
await exec(
`yarn test-storybook ${flags.join(' ')}`,
{
...execOptions,
env: {
JEST_JUNIT_OUTPUT_FILE: junitFilename,
TEST_ROOT: sandboxDir,
},
},
{ dryRun, debug }
);
},
};