-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
/
test-runner.ts
31 lines (26 loc) · 943 Bytes
/
test-runner.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
import { servePackages } from '../utils/serve-packages';
import type { Task } from '../task';
import { exec } from '../utils/exec';
import { serveSandbox } from '../utils/serve-sandbox';
export const testRunner: Task = {
junit: true,
before: ['publish', 'build'],
async ready() {
return false;
},
async run(_, { sandboxDir, builtSandboxDir, junitFilename }) {
const execOptions = { cwd: sandboxDir };
// We could split this out into a separate task if it became annoying
const publishController = await servePackages({});
await exec(`yarn add --dev @storybook/test-runner`, execOptions);
const storybookController = await serveSandbox(builtSandboxDir, {});
await exec(`yarn test-storybook --url http://localhost:8001 --junit`, {
...execOptions,
env: {
JEST_JUNIT_OUTPUT_FILE: junitFilename,
},
});
publishController.abort();
storybookController.abort();
},
};