creevey 0.9.0-beta.0 → 0.9.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +9 -1
- package/addon/README.md +3 -0
- package/addon/package.json +5 -0
- package/docs/config.md +29 -26
- package/jest.config.js +6 -0
- package/lib/cjs/client/addon/Manager.js +122 -270
- package/lib/cjs/client/addon/components/Addon.js +17 -38
- package/lib/cjs/client/addon/components/Icons.js +11 -7
- package/lib/cjs/client/addon/components/Panel.js +17 -13
- package/lib/cjs/client/addon/components/TestSelect.js +11 -9
- package/lib/cjs/client/addon/components/Tools.js +22 -41
- package/lib/cjs/client/addon/decorator.js +1 -1
- package/lib/cjs/client/addon/index.js +31 -0
- package/lib/cjs/client/addon/preset.ie11.js +74 -0
- package/lib/cjs/client/addon/preset.js +4 -68
- package/lib/cjs/client/addon/preset.sb7.js +19 -0
- package/lib/cjs/client/addon/preview.js +14 -0
- package/lib/cjs/client/addon/register.js +46 -70
- package/lib/cjs/client/addon/utils.js +6 -2
- package/lib/cjs/client/addon/withCreevey.js +161 -366
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +22 -18
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
- package/lib/cjs/client/shared/components/ImagesView/index.js +9 -9
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
- package/lib/cjs/client/shared/components/ResultsPage.js +39 -69
- package/lib/cjs/client/shared/creeveyClientApi.js +55 -82
- package/lib/cjs/client/shared/helpers.js +139 -210
- package/lib/cjs/client/shared/viewMode.js +5 -5
- package/lib/cjs/client/web/142.js +2 -0
- package/lib/cjs/client/web/142.js.LICENSE.txt +12 -0
- package/lib/cjs/client/web/32.js +1 -0
- package/lib/cjs/client/web/551.js +1 -0
- package/lib/cjs/client/web/566.js +2 -0
- package/lib/cjs/client/web/566.js.LICENSE.txt +31 -0
- package/lib/cjs/client/web/691.js +2 -0
- package/lib/cjs/client/web/691.js.LICENSE.txt +8 -0
- package/lib/cjs/client/web/725.js +1 -0
- package/lib/cjs/client/web/main.js +2 -38
- package/lib/cjs/client/web/main.js.LICENSE.txt +49 -0
- package/lib/cjs/creevey.js +3 -5
- package/lib/cjs/index.js +5 -5
- package/lib/cjs/server/config.js +3 -5
- package/lib/cjs/server/docker.js +3 -7
- package/lib/cjs/server/extract.js +1 -5
- package/lib/cjs/server/index.js +1 -1
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/cjs/server/loaders/babel/helpers.js +13 -23
- package/lib/cjs/server/loaders/babel/register.js +2 -4
- package/lib/cjs/server/loaders/webpack/compile.js +34 -51
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +20 -22
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +2 -7
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +2 -2
- package/lib/cjs/server/loaders/webpack/start.js +1 -1
- package/lib/cjs/server/logger.js +2 -1
- package/lib/cjs/server/master/index.js +2 -2
- package/lib/cjs/server/master/pool.js +9 -18
- package/lib/cjs/server/master/runner.js +53 -66
- package/lib/cjs/server/master/server.js +5 -3
- package/lib/cjs/server/messages.js +8 -10
- package/lib/cjs/server/selenium/browser.js +58 -70
- package/lib/cjs/server/selenium/selenoid.js +5 -7
- package/lib/cjs/server/stories.js +16 -33
- package/lib/cjs/server/storybook/entry.js +7 -22
- package/lib/cjs/server/storybook/helpers.js +21 -28
- package/lib/cjs/server/storybook/providers/browser.js +10 -14
- package/lib/cjs/server/storybook/providers/hybrid.js +17 -14
- package/lib/cjs/server/storybook/providers/nodejs.js +12 -12
- package/lib/cjs/server/{parser.js → testsFiles/parser.js} +1 -14
- package/lib/cjs/server/testsFiles/register.js +44 -0
- package/lib/cjs/server/update.js +1 -5
- package/lib/cjs/server/utils.js +27 -36
- package/lib/cjs/server/worker/reporter.js +8 -20
- package/lib/cjs/server/worker/worker.js +9 -19
- package/lib/cjs/shared/index.js +101 -0
- package/lib/cjs/shared/serializeRegExp.js +42 -0
- package/lib/cjs/types.js +7 -6
- package/lib/esm/client/addon/Manager.js +122 -270
- package/lib/esm/client/addon/components/Addon.js +15 -34
- package/lib/esm/client/addon/components/Icons.js +10 -6
- package/lib/esm/client/addon/components/Panel.js +17 -13
- package/lib/esm/client/addon/components/TestSelect.js +11 -9
- package/lib/esm/client/addon/components/Tools.js +20 -37
- package/lib/esm/client/addon/decorator.js +1 -1
- package/lib/esm/client/addon/index.js +2 -0
- package/lib/esm/client/addon/preset.ie11.js +59 -0
- package/lib/esm/client/addon/preset.js +4 -52
- package/lib/esm/client/addon/preset.sb7.js +8 -0
- package/lib/esm/client/addon/preview.js +5 -0
- package/lib/esm/client/addon/register.js +42 -66
- package/lib/esm/client/addon/utils.js +3 -2
- package/lib/esm/client/addon/withCreevey.js +156 -363
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
- package/lib/esm/client/shared/components/ResultsPage.js +36 -64
- package/lib/esm/client/shared/creeveyClientApi.js +57 -84
- package/lib/esm/client/shared/helpers.js +123 -194
- package/lib/esm/client/shared/viewMode.js +4 -4
- package/lib/esm/creevey.js +3 -5
- package/lib/esm/index.js +2 -4
- package/lib/esm/server/config.js +3 -5
- package/lib/esm/server/docker.js +2 -2
- package/lib/esm/server/extract.js +1 -3
- package/lib/esm/server/index.js +1 -1
- package/lib/esm/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/esm/server/loaders/babel/helpers.js +12 -22
- package/lib/esm/server/loaders/babel/register.js +3 -5
- package/lib/esm/server/loaders/webpack/compile.js +35 -52
- package/lib/esm/server/loaders/webpack/creevey-loader.js +9 -10
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +2 -6
- package/lib/esm/server/loaders/webpack/mdx-loader.js +2 -2
- package/lib/esm/server/loaders/webpack/start.js +1 -1
- package/lib/esm/server/master/index.js +2 -2
- package/lib/esm/server/master/pool.js +7 -18
- package/lib/esm/server/master/runner.js +53 -66
- package/lib/esm/server/master/server.js +5 -3
- package/lib/esm/server/messages.js +3 -5
- package/lib/esm/server/selenium/browser.js +54 -66
- package/lib/esm/server/selenium/selenoid.js +4 -6
- package/lib/esm/server/stories.js +16 -32
- package/lib/esm/server/storybook/entry.js +5 -22
- package/lib/esm/server/storybook/helpers.js +12 -21
- package/lib/esm/server/storybook/providers/browser.js +6 -9
- package/lib/esm/server/storybook/providers/hybrid.js +10 -13
- package/lib/esm/server/storybook/providers/nodejs.js +10 -11
- package/lib/esm/server/{parser.js → testsFiles/parser.js} +1 -14
- package/lib/esm/server/testsFiles/register.js +31 -0
- package/lib/esm/server/update.js +1 -5
- package/lib/esm/server/utils.js +18 -31
- package/lib/esm/server/worker/reporter.js +8 -20
- package/lib/esm/server/worker/worker.js +9 -19
- package/lib/esm/shared/index.js +78 -0
- package/lib/esm/shared/serializeRegExp.js +24 -0
- package/lib/esm/types.js +1 -0
- package/lib/types/client/addon/Manager.d.ts +2 -2
- package/lib/types/client/addon/components/TestSelect.d.ts +0 -1
- package/lib/types/client/addon/index.d.ts +2 -0
- package/lib/types/client/addon/preset.d.ts +0 -22
- package/lib/types/client/addon/preset.ie11.d.ts +10 -0
- package/lib/types/client/addon/preset.sb7.d.ts +2 -0
- package/lib/types/client/addon/preview.d.ts +4 -0
- package/lib/types/client/addon/utils.d.ts +1 -0
- package/lib/types/client/addon/withCreevey.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +0 -1
- package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +1 -1
- package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +0 -1
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +0 -1
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +1 -1
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +0 -1
- package/lib/types/client/shared/components/ResultsPage.d.ts +1 -1
- package/lib/types/client/web/CreeveyApp.d.ts +0 -1
- package/lib/types/client/web/CreeveyLoader.d.ts +1 -2
- package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +1 -1
- package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +0 -1
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +4 -4
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +0 -1
- package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +1 -1
- package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +1 -1
- package/lib/types/index.d.ts +4 -2
- package/lib/types/server/config.d.ts +1 -1
- package/lib/types/server/loaders/babel/register.d.ts +1 -1
- package/lib/types/server/loaders/webpack/creevey-loader.d.ts +4 -2
- package/lib/types/server/logger.d.ts +6 -2
- package/lib/types/server/messages.d.ts +13 -12
- package/lib/types/server/selenium/browser.d.ts +5 -3
- package/lib/types/server/storybook/entry.d.ts +2 -3
- package/lib/types/server/storybook/helpers.d.ts +1 -1
- package/lib/types/server/storybook/providers/browser.d.ts +2 -4
- package/lib/types/server/storybook/providers/hybrid.d.ts +2 -4
- package/lib/types/server/storybook/providers/nodejs.d.ts +3 -3
- package/lib/types/server/{parser.d.ts → testsFiles/parser.d.ts} +1 -1
- package/lib/types/server/testsFiles/register.d.ts +2 -0
- package/lib/types/server/utils.d.ts +5 -1
- package/lib/types/{shared.d.ts → shared/index.d.ts} +1 -10
- package/lib/types/shared/serializeRegExp.d.ts +9 -0
- package/lib/types/types.d.ts +7 -9
- package/package.json +119 -102
- package/preset/ie11.js +5 -0
- package/{preset.js → preset/index.js} +2 -2
- package/preset/sb7.js +5 -0
- package/types/global.d.ts +5 -0
- package/types/mdx.d.ts +3 -2
- package/lib/cjs/client/web/1.js +0 -13
- package/lib/cjs/client/web/2.js +0 -1
- package/lib/cjs/shared.js +0 -107
- package/lib/esm/shared.js +0 -76
- package/storybook-static/stories.json +0 -21
@@ -1,5 +1,3 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
1
|
import path from 'path';
|
4
2
|
import { copyFile, mkdir } from 'fs';
|
5
3
|
import { promisify } from 'util';
|
@@ -9,63 +7,40 @@ import Pool from './pool';
|
|
9
7
|
const copyFileAsync = promisify(copyFile);
|
10
8
|
const mkdirAsync = promisify(mkdir);
|
11
9
|
export default class Runner extends EventEmitter {
|
10
|
+
pools = {};
|
11
|
+
tests = {};
|
12
|
+
|
12
13
|
get isRunning() {
|
13
14
|
return Object.values(this.pools).some(pool => pool.isRunning);
|
14
15
|
}
|
15
16
|
|
16
17
|
constructor(config) {
|
17
18
|
super();
|
19
|
+
this.failFast = config.failFast;
|
20
|
+
this.screenDir = config.screenDir;
|
21
|
+
this.reportDir = config.reportDir;
|
22
|
+
this.browsers = Object.keys(config.browsers);
|
23
|
+
this.browsers.map(browser => this.pools[browser] = new Pool(config, browser)).map(pool => pool.on('test', this.handlePoolMessage));
|
24
|
+
}
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
id,
|
34
|
-
status,
|
35
|
-
result
|
36
|
-
} = message;
|
37
|
-
const test = this.tests[id];
|
38
|
-
if (!test) return;
|
39
|
-
const {
|
40
|
-
browser,
|
41
|
-
testName,
|
42
|
-
storyPath,
|
43
|
-
storyId
|
44
|
-
} = test; // TODO Handle 'retrying' status
|
45
|
-
|
46
|
-
test.status = status == 'retrying' ? 'failed' : status;
|
47
|
-
|
48
|
-
if (!result) {
|
49
|
-
this.sendUpdate({
|
50
|
-
tests: {
|
51
|
-
[id]: {
|
52
|
-
id,
|
53
|
-
browser,
|
54
|
-
testName,
|
55
|
-
storyPath,
|
56
|
-
status: test.status,
|
57
|
-
storyId
|
58
|
-
}
|
59
|
-
}
|
60
|
-
});
|
61
|
-
return;
|
62
|
-
}
|
26
|
+
handlePoolMessage = message => {
|
27
|
+
const {
|
28
|
+
id,
|
29
|
+
status,
|
30
|
+
result
|
31
|
+
} = message;
|
32
|
+
const test = this.tests[id];
|
33
|
+
if (!test) return;
|
34
|
+
const {
|
35
|
+
browser,
|
36
|
+
testName,
|
37
|
+
storyPath,
|
38
|
+
storyId
|
39
|
+
} = test; // TODO Handle 'retrying' status
|
63
40
|
|
64
|
-
|
65
|
-
test.results = [];
|
66
|
-
}
|
41
|
+
test.status = status == 'retrying' ? 'failed' : status;
|
67
42
|
|
68
|
-
|
43
|
+
if (!result) {
|
69
44
|
this.sendUpdate({
|
70
45
|
tests: {
|
71
46
|
[id]: {
|
@@ -74,29 +49,41 @@ export default class Runner extends EventEmitter {
|
|
74
49
|
testName,
|
75
50
|
storyPath,
|
76
51
|
status: test.status,
|
77
|
-
results: [result],
|
78
52
|
storyId
|
79
53
|
}
|
80
54
|
}
|
81
55
|
});
|
82
|
-
|
83
|
-
}
|
56
|
+
return;
|
57
|
+
}
|
84
58
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
59
|
+
if (!test.results) {
|
60
|
+
test.results = [];
|
61
|
+
}
|
62
|
+
|
63
|
+
test.results.push(result);
|
64
|
+
this.sendUpdate({
|
65
|
+
tests: {
|
66
|
+
[id]: {
|
67
|
+
id,
|
68
|
+
browser,
|
69
|
+
testName,
|
70
|
+
storyPath,
|
71
|
+
status: test.status,
|
72
|
+
results: [result],
|
73
|
+
storyId
|
74
|
+
}
|
91
75
|
}
|
92
76
|
});
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
this.
|
97
|
-
|
98
|
-
|
99
|
-
|
77
|
+
if (this.failFast && status == 'failed') this.stop();
|
78
|
+
};
|
79
|
+
handlePoolStop = () => {
|
80
|
+
if (!this.isRunning) {
|
81
|
+
this.sendUpdate({
|
82
|
+
isRunning: false
|
83
|
+
});
|
84
|
+
this.emit('stop');
|
85
|
+
}
|
86
|
+
};
|
100
87
|
|
101
88
|
async init() {
|
102
89
|
await Promise.all(Object.values(this.pools).map(pool => pool.init()));
|
@@ -51,7 +51,7 @@ export default function server(reportDir, port, ui) {
|
|
51
51
|
type: 'update',
|
52
52
|
payload: deserializedStories
|
53
53
|
});
|
54
|
-
Object.values(cluster.workers).filter(isDefined).filter(worker => worker.isConnected()).forEach(worker => sendStoriesMessage(worker, {
|
54
|
+
Object.values(cluster.workers ?? {}).filter(isDefined).filter(worker => worker.isConnected()).forEach(worker => sendStoriesMessage(worker, {
|
55
55
|
type: 'update',
|
56
56
|
payload: deserializedStories
|
57
57
|
}));
|
@@ -66,7 +66,7 @@ export default function server(reportDir, port, ui) {
|
|
66
66
|
workerId,
|
67
67
|
options
|
68
68
|
} = ctx.request.body;
|
69
|
-
const worker = Object.values(cluster.workers).filter(isDefined).find(worker => worker.process.pid == workerId); // NOTE: Hypothetical case when someone send to us capture req and we don't have a worker with browser session for it
|
69
|
+
const worker = Object.values(cluster.workers ?? {}).filter(isDefined).find(worker => worker.process.pid == workerId); // NOTE: Hypothetical case when someone send to us capture req and we don't have a worker with browser session for it
|
70
70
|
|
71
71
|
if (!worker) return;
|
72
72
|
await new Promise(resolve => {
|
@@ -98,7 +98,9 @@ export default function server(reportDir, port, ui) {
|
|
98
98
|
void creeveyApi.then(api => {
|
99
99
|
api.subscribe(wss);
|
100
100
|
wss.on('connection', ws => {
|
101
|
-
ws.on('message', message =>
|
101
|
+
ws.on('message', (message, isBinary) => {
|
102
|
+
api.handleMessage(ws, isBinary ? message : message.toString());
|
103
|
+
});
|
102
104
|
});
|
103
105
|
});
|
104
106
|
return resolveApi;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import cluster from 'cluster';
|
2
2
|
|
3
3
|
function emitMessage(message) {
|
4
|
-
var _process$send, _process
|
4
|
+
var _process$send, _process;
|
5
5
|
|
6
6
|
if (cluster.isWorker && !process.connected) return false;
|
7
|
-
return (_process$send = (_process
|
7
|
+
return ((_process$send = (_process = process).send) === null || _process$send === void 0 ? void 0 : _process$send.call(_process, message)) ?? // @ts-expect-error: wrong typings `process.emit` return boolean
|
8
8
|
process.emit('message', message);
|
9
9
|
}
|
10
10
|
|
@@ -158,9 +158,7 @@ export function subscribeOn(scope, handler) {
|
|
158
158
|
}
|
159
159
|
const workers = new Map();
|
160
160
|
export function subscribeOnWorker(worker, scope, handler) {
|
161
|
-
|
162
|
-
|
163
|
-
const workerHandlers = (_workers$get = workers.get(worker)) !== null && _workers$get !== void 0 ? _workers$get : createHandlers();
|
161
|
+
const workerHandlers = workers.get(worker) ?? createHandlers();
|
164
162
|
|
165
163
|
if (!workers.has(worker)) {
|
166
164
|
workers.set(worker, workerHandlers);
|
@@ -12,6 +12,7 @@ import { colors, logger } from '../logger';
|
|
12
12
|
import { emitStoriesMessage, subscribeOn } from '../messages';
|
13
13
|
import { importStorybookCoreEvents, isStorybookVersionLessThan } from '../storybook/helpers';
|
14
14
|
import { isShuttingDown, LOCALHOST_REGEXP, runSequence } from '../utils';
|
15
|
+
const storybookRootID = isStorybookVersionLessThan(7) ? 'root' : 'storybook-root';
|
15
16
|
const DOCKER_INTERNAL = 'host.docker.internal';
|
16
17
|
let browserLogger = logger;
|
17
18
|
let browserName = '';
|
@@ -23,9 +24,7 @@ function getSessionData(grid, sessionId = '') {
|
|
23
24
|
gridUrl.pathname = `/host/${sessionId}`;
|
24
25
|
return new Promise((resolve, reject) => (gridUrl.protocol == 'https:' ? https : http).get(gridUrl.toString(), res => {
|
25
26
|
if (res.statusCode !== 200) {
|
26
|
-
|
27
|
-
|
28
|
-
return reject(new Error(`Couldn't get session data for ${sessionId}. Status code: ${(_res$statusCode = res.statusCode) !== null && _res$statusCode !== void 0 ? _res$statusCode : 'Unknown'}`));
|
27
|
+
return reject(new Error(`Couldn't get session data for ${sessionId}. Status code: ${res.statusCode ?? 'Unknown'}`));
|
29
28
|
}
|
30
29
|
|
31
30
|
let data = '';
|
@@ -35,9 +34,7 @@ function getSessionData(grid, sessionId = '') {
|
|
35
34
|
try {
|
36
35
|
resolve(JSON.parse(data));
|
37
36
|
} catch (error) {
|
38
|
-
|
39
|
-
|
40
|
-
reject(new Error(`Couldn't get session data for ${sessionId}. ${error instanceof Error ? (_error$stack = error.stack) !== null && _error$stack !== void 0 ? _error$stack : error.message : error}`));
|
37
|
+
reject(new Error(`Couldn't get session data for ${sessionId}. ${error instanceof Error ? error.stack ?? error.message : error}`));
|
41
38
|
}
|
42
39
|
});
|
43
40
|
}));
|
@@ -92,10 +89,10 @@ function getUrlChecker(browser) {
|
|
92
89
|
// We don't use any page load strategies except `NONE`
|
93
90
|
// because other add significant delay and some of them don't work in earlier chrome versions
|
94
91
|
// Browsers always load page successful even it's failed
|
95
|
-
// So we just check
|
92
|
+
// So we just check `root` element
|
96
93
|
|
97
|
-
browserLogger.debug(`Checking ${chalk.cyan(
|
98
|
-
return source.includes(
|
94
|
+
browserLogger.debug(`Checking ${chalk.cyan(`#${storybookRootID}`)} existence on ${chalk.magenta(url)}`);
|
95
|
+
return source.includes(`id="${storybookRootID}"`);
|
99
96
|
} catch (error) {
|
100
97
|
return false;
|
101
98
|
}
|
@@ -103,17 +100,6 @@ function getUrlChecker(browser) {
|
|
103
100
|
}
|
104
101
|
|
105
102
|
async function waitForStorybook(browser) {
|
106
|
-
// NOTE: Storybook 5.x doesn't have the `last` method
|
107
|
-
if (isStorybookVersionLessThan(6)) {
|
108
|
-
browserLogger.debug('Waiting for `load` event to make sure that storybook is initiated');
|
109
|
-
return browser.executeAsyncScript(function (callback) {
|
110
|
-
if (document.readyState == 'complete') return callback();
|
111
|
-
window.addEventListener('load', function () {
|
112
|
-
callback();
|
113
|
-
});
|
114
|
-
});
|
115
|
-
}
|
116
|
-
|
117
103
|
browserLogger.debug('Waiting for `setStories` event to make sure that storybook is initiated');
|
118
104
|
let wait = true;
|
119
105
|
let isTimeout = false;
|
@@ -123,12 +109,21 @@ async function waitForStorybook(browser) {
|
|
123
109
|
isTimeout = true;
|
124
110
|
}, 60000);
|
125
111
|
|
126
|
-
while (wait) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
112
|
+
while (wait !== false) {
|
113
|
+
if (isStorybookVersionLessThan(7)) {
|
114
|
+
wait = await browser.executeAsyncScript(function (SET_STORIES, callback) {
|
115
|
+
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return callback(true);
|
116
|
+
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_STORIES) == undefined) return callback(true);
|
117
|
+
return callback(false);
|
118
|
+
}, Events.SET_STORIES);
|
119
|
+
} else {
|
120
|
+
wait = await browser.executeScript(function (SET_GLOBALS) {
|
121
|
+
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return true;
|
122
|
+
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_GLOBALS) == undefined) return true;
|
123
|
+
return false;
|
124
|
+
}, Events.SET_GLOBALS);
|
125
|
+
}
|
126
|
+
|
132
127
|
if (!wait) clearTimeout(initiateTimeout);
|
133
128
|
}
|
134
129
|
|
@@ -136,11 +131,11 @@ async function waitForStorybook(browser) {
|
|
136
131
|
}
|
137
132
|
|
138
133
|
async function resetMousePosition(browser) {
|
139
|
-
var
|
134
|
+
var _await$browser$getCap, _await$browser$getCap2;
|
140
135
|
|
141
136
|
browserLogger.debug('Resetting mouse position to the top-left corner');
|
142
137
|
const browserName = (await browser.getCapabilities()).getBrowserName();
|
143
|
-
const [browserVersion] = (
|
138
|
+
const [browserVersion] = ((_await$browser$getCap = (await browser.getCapabilities()).getBrowserVersion()) === null || _await$browser$getCap === void 0 ? void 0 : _await$browser$getCap.split('.')) ?? ((_await$browser$getCap2 = (await browser.getCapabilities()).get('version')) === null || _await$browser$getCap2 === void 0 ? void 0 : _await$browser$getCap2.split('.')) ?? []; // NOTE Reset mouse position to support keweb selenium grid browser versions
|
144
139
|
|
145
140
|
if (browserName == 'chrome' && browserVersion == '70') {
|
146
141
|
const {
|
@@ -224,10 +219,10 @@ const getScrollBarWidth = (() => {
|
|
224
219
|
|
225
220
|
|
226
221
|
async function hasScrollBar(browser) {
|
227
|
-
var _await$browser$
|
222
|
+
var _await$browser$getCap3;
|
228
223
|
|
229
224
|
const browserName = (await browser.getCapabilities()).getBrowserName();
|
230
|
-
const [browserVersion] = (
|
225
|
+
const [browserVersion] = ((_await$browser$getCap3 = (await browser.getCapabilities()).getBrowserVersion()) === null || _await$browser$getCap3 === void 0 ? void 0 : _await$browser$getCap3.split('.')) ?? [];
|
231
226
|
return browserName != 'Safari' && // NOTE This need to work with keweb selenium grid
|
232
227
|
!(browserName == 'firefox' && browserVersion == '61');
|
233
228
|
}
|
@@ -278,7 +273,8 @@ async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
|
278
273
|
const scrollOffset = isFitVertically || isScreenshotWithoutScrollBar ? 0 : scrollBarWidth;
|
279
274
|
const i = (y * compositeImage.width + x) * 4;
|
280
275
|
const j = // NOTE compositeImage(x, y) => image(x, y)
|
281
|
-
(y % viewportHeight * (viewportWidth + scrollOffset) + x % viewportWidth) * 4 + (
|
276
|
+
(y % viewportHeight * (viewportWidth + scrollOffset) + x % viewportWidth) * 4 + ( // NOTE Offset for last row/col image
|
277
|
+
isLastRow ? yOffset * (viewportWidth + scrollOffset) * 4 : 0) + (isLastCol ? xOffset * 4 : 0);
|
282
278
|
const image = images[row * cols + col];
|
283
279
|
compositeImage.data[i + 0] = image.data[j + 0];
|
284
280
|
compositeImage.data[i + 1] = image.data[j + 1];
|
@@ -327,7 +323,7 @@ export async function takeScreenshot(browser, captureElement, ignoreElements) {
|
|
327
323
|
const {
|
328
324
|
elementRect,
|
329
325
|
windowRect
|
330
|
-
} = rects
|
326
|
+
} = rects ?? {};
|
331
327
|
if (!elementRect || !windowRect) throw new Error(`Couldn't find element with selector: '${captureElement}'`);
|
332
328
|
const isFitIntoViewport = elementRect.width + elementRect.left <= windowRect.width && elementRect.height + elementRect.top <= windowRect.height;
|
333
329
|
if (isFitIntoViewport) browserLogger.debug(`Capturing ${chalk.cyan(captureElement)}`);else browserLogger.debug(`Capturing composite screenshot image of ${chalk.cyan(captureElement)}`);
|
@@ -353,19 +349,14 @@ async function selectStory(browser, {
|
|
353
349
|
return callback(["Creevey can't switch story. This may happened if forget to add `creevey` addon to your storybook config, or storybook not loaded in browser due syntax error."]);
|
354
350
|
}
|
355
351
|
|
356
|
-
window.__CREEVEY_SELECT_STORY__(id, kind, name, shouldWaitForReady, callback);
|
352
|
+
void window.__CREEVEY_SELECT_STORY__(id, kind, name, shouldWaitForReady, callback);
|
357
353
|
}, id, kind, name, waitForReady);
|
358
|
-
const [errorMessage, isCaptureCalled = false] = result
|
354
|
+
const [errorMessage, isCaptureCalled = false] = result ?? [];
|
359
355
|
if (errorMessage) throw new Error(errorMessage);
|
360
356
|
return isCaptureCalled;
|
361
357
|
}
|
362
358
|
|
363
359
|
export async function updateStorybookGlobals(browser, globals) {
|
364
|
-
if (isStorybookVersionLessThan(6)) {
|
365
|
-
browserLogger.warn('Globals are not supported by Storybook versions less than 6');
|
366
|
-
return;
|
367
|
-
}
|
368
|
-
|
369
360
|
browserLogger.debug('Applying storybook globals');
|
370
361
|
await browser.executeScript(function (globals) {
|
371
362
|
window.__CREEVEY_UPDATE_GLOBALS__(globals);
|
@@ -402,13 +393,12 @@ async function resolveCreeveyHost(browser, port) {
|
|
402
393
|
const addresses = getAddresses();
|
403
394
|
creeveyServerHost = await browser.executeAsyncScript(function (hosts, port, callback) {
|
404
395
|
void Promise.all(hosts.map(function (host) {
|
405
|
-
return
|
406
|
-
|
407
|
-
|
408
|
-
fetch('http://' + host + ':' + port + '/ping').then(resolve).catch(reject);
|
409
|
-
}).then(function (response) {
|
396
|
+
return Promise.race([// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
397
|
+
fetch('http://' + host + ':' + port + '/ping').then(function (response) {
|
410
398
|
return response.text();
|
411
|
-
})
|
399
|
+
}), new Promise((_resolve, reject) => {
|
400
|
+
setTimeout(reject, 5000);
|
401
|
+
})]).then(function (pong) {
|
412
402
|
return pong == 'pong' ? host : null;
|
413
403
|
}).catch(function () {
|
414
404
|
return null;
|
@@ -423,20 +413,17 @@ async function resolveCreeveyHost(browser, port) {
|
|
423
413
|
return creeveyServerHost;
|
424
414
|
}
|
425
415
|
|
426
|
-
export async function loadStoriesFromBrowser(
|
416
|
+
export async function loadStoriesFromBrowser() {
|
427
417
|
if (!browser) throw new Error("Can't get stories from browser if webdriver isn't connected");
|
428
|
-
const
|
429
|
-
const stories = await browser.executeAsyncScript(function (creeveyHost, creeveyPort, callback) {
|
430
|
-
window.__CREEVEY_SERVER_HOST__ = creeveyHost;
|
431
|
-
window.__CREEVEY_SERVER_PORT__ = creeveyPort;
|
418
|
+
const stories = await browser.executeAsyncScript(function (callback) {
|
432
419
|
void window.__CREEVEY_GET_STORIES__().then(callback);
|
433
|
-
}
|
420
|
+
});
|
434
421
|
if (!stories) throw new Error("Can't get stories, it seems creevey or storybook API isn't available");
|
435
422
|
return stories;
|
436
423
|
}
|
437
|
-
export async function getBrowser(config,
|
424
|
+
export async function getBrowser(config, options) {
|
438
425
|
if (browser) return browser;
|
439
|
-
browserName =
|
426
|
+
browserName = options.browser;
|
440
427
|
const browserConfig = config.browsers[browserName];
|
441
428
|
const {
|
442
429
|
gridUrl = config.gridUrl,
|
@@ -466,7 +453,7 @@ export async function getBrowser(config, name) {
|
|
466
453
|
const url = new URL(gridUrl);
|
467
454
|
url.username = url.username ? '********' : '';
|
468
455
|
url.password = url.password ? '********' : '';
|
469
|
-
browserLogger.debug(`(${
|
456
|
+
browserLogger.debug(`(${browserName}) Connecting to Selenium ${chalk.magenta(url.toString())}`);
|
470
457
|
browser = await new Builder().usingServer(gridUrl).withCapabilities(capabilities).build();
|
471
458
|
const sessionId = (_await$browser$getSes = await browser.getSession()) === null || _await$browser$getSes === void 0 ? void 0 : _await$browser$getSes.getId();
|
472
459
|
let browserHost = '';
|
@@ -480,12 +467,12 @@ export async function getBrowser(config, name) {
|
|
480
467
|
/* noop */
|
481
468
|
}
|
482
469
|
|
483
|
-
browserLogger.debug(`(${
|
470
|
+
browserLogger.debug(`(${browserName}) Connected successful with ${[chalk.green(browserHost), chalk.magenta(sessionId)].filter(Boolean).join(':')}`);
|
484
471
|
browserLogger = getLogger(sessionId);
|
485
472
|
prefix.apply(browserLogger, {
|
486
473
|
format(level) {
|
487
474
|
const levelColor = colors[level.toUpperCase()];
|
488
|
-
return `[${
|
475
|
+
return `[${browserName}:${chalk.gray(sessionId)}] ${levelColor(level)} =>`;
|
489
476
|
}
|
490
477
|
|
491
478
|
});
|
@@ -498,7 +485,7 @@ export async function getBrowser(config, name) {
|
|
498
485
|
});
|
499
486
|
}, () => viewport && browser && resizeViewport(browser, viewport), () => browser && openStorybookPage(browser, realAddress, config.resolveStorybookUrl), () => browser && waitForStorybook(browser)], () => !isShuttingDown.current);
|
500
487
|
} catch (originalError) {
|
501
|
-
var
|
488
|
+
var _browser4;
|
502
489
|
|
503
490
|
if (isShuttingDown.current) {
|
504
491
|
var _browser3;
|
@@ -509,7 +496,7 @@ export async function getBrowser(config, name) {
|
|
509
496
|
}
|
510
497
|
|
511
498
|
if (originalError instanceof Error && originalError.name == 'ResolveUrlError') throw originalError;
|
512
|
-
const error = new Error(`Can't load storybook root page by URL ${(
|
499
|
+
const error = new Error(`Can't load storybook root page by URL ${(await ((_browser4 = browser) === null || _browser4 === void 0 ? void 0 : _browser4.getCurrentUrl())) ?? realAddress}`);
|
513
500
|
if (originalError instanceof Error) error.stack = originalError.stack;
|
514
501
|
throw error;
|
515
502
|
}
|
@@ -518,9 +505,12 @@ export async function getBrowser(config, name) {
|
|
518
505
|
await updateStorybookGlobals(browser, _storybookGlobals);
|
519
506
|
}
|
520
507
|
|
521
|
-
await browser.
|
508
|
+
const creeveyHost = await resolveCreeveyHost(browser, options.port);
|
509
|
+
await browser.executeScript(function (workerId, creeveyHost, creeveyPort) {
|
522
510
|
window.__CREEVEY_WORKER_ID__ = workerId;
|
523
|
-
|
511
|
+
window.__CREEVEY_SERVER_HOST__ = creeveyHost;
|
512
|
+
window.__CREEVEY_SERVER_PORT__ = creeveyPort;
|
513
|
+
}, process.pid, creeveyHost, options.port);
|
524
514
|
return browser;
|
525
515
|
}
|
526
516
|
|
@@ -546,7 +536,7 @@ export async function closeBrowser() {
|
|
546
536
|
}
|
547
537
|
}
|
548
538
|
export async function switchStory() {
|
549
|
-
var _this$currentTest, _this$currentTest$ctx
|
539
|
+
var _this$currentTest, _this$currentTest$ctx;
|
550
540
|
|
551
541
|
let testOrSuite = this.currentTest;
|
552
542
|
if (!testOrSuite) throw new Error("Can't switch story, because test context doesn't have 'currentTest' field");
|
@@ -570,10 +560,10 @@ export async function switchStory() {
|
|
570
560
|
parameters
|
571
561
|
} = story;
|
572
562
|
const {
|
573
|
-
captureElement =
|
563
|
+
captureElement = `#${storybookRootID}`,
|
574
564
|
waitForReady,
|
575
565
|
ignoreElements
|
576
|
-
} =
|
566
|
+
} = parameters.creevey ?? {};
|
577
567
|
browserLogger.debug(`Switching to story ${chalk.cyan(kind)}/${chalk.cyan(name)} by id ${chalk.magenta(id)}`);
|
578
568
|
if (captureElement) Object.defineProperty(this, 'captureElement', {
|
579
569
|
enumerable: true,
|
@@ -589,8 +579,6 @@ export async function switchStory() {
|
|
589
579
|
let storyPlayResolver;
|
590
580
|
let waitForComplete = new Promise(resolve => storyPlayResolver = resolve);
|
591
581
|
const unsubscribe = subscribeOn('stories', message => {
|
592
|
-
var _payload$captureEleme, _payload$ignoreElemen;
|
593
|
-
|
594
582
|
if (message.type != 'capture') return;
|
595
583
|
const {
|
596
584
|
payload = {},
|
@@ -598,7 +586,7 @@ export async function switchStory() {
|
|
598
586
|
imageName
|
599
587
|
} = {}
|
600
588
|
} = message;
|
601
|
-
void takeScreenshot(this.browser,
|
589
|
+
void takeScreenshot(this.browser, payload.captureElement ?? captureElement, payload.ignoreElements ?? ignoreElements).then(screenshot => {
|
602
590
|
this.screenshots.push({
|
603
591
|
imageName,
|
604
592
|
screenshot
|
@@ -5,7 +5,7 @@ import { downloadBinary, getCreeveyCache } from '../utils';
|
|
5
5
|
import { pullImages, runImage } from '../docker';
|
6
6
|
import { Octokit } from '@octokit/core';
|
7
7
|
import { subscribeOn } from '../messages';
|
8
|
-
import
|
8
|
+
import cluster from 'cluster';
|
9
9
|
import { chmod, exec } from 'shelljs';
|
10
10
|
const mkdirAsync = promisify(mkdir);
|
11
11
|
const writeFileAsync = promisify(writeFile);
|
@@ -41,8 +41,6 @@ async function createSelenoidConfig(browsers, {
|
|
41
41
|
}
|
42
42
|
|
43
43
|
async function downloadSelenoidBinary(destination) {
|
44
|
-
var _assets$find;
|
45
|
-
|
46
44
|
const platformNameMapping = {
|
47
45
|
darwin: 'selenoid_darwin_amd64',
|
48
46
|
linux: 'selenoid_linux_amd64',
|
@@ -59,9 +57,9 @@ async function downloadSelenoidBinary(destination) {
|
|
59
57
|
const {
|
60
58
|
browser_download_url: downloadUrl,
|
61
59
|
size: binarySize
|
62
|
-
} =
|
60
|
+
} = assets.find(({
|
63
61
|
name
|
64
|
-
}) => platformNameMapping[process.platform] == name)
|
62
|
+
}) => platformNameMapping[process.platform] == name) ?? {};
|
65
63
|
if (existsSync(destination) && lstatSync(destination).size == binarySize) return;
|
66
64
|
|
67
65
|
if (!downloadUrl) {
|
@@ -73,7 +71,7 @@ async function downloadSelenoidBinary(destination) {
|
|
73
71
|
|
74
72
|
export async function startSelenoidStandalone(config, debug) {
|
75
73
|
config.gridUrl = 'http://localhost:4444/wd/hub';
|
76
|
-
if (isWorker) return;
|
74
|
+
if (cluster.isWorker) return;
|
77
75
|
const browsers = Object.values(config.browsers).filter(browser => !browser.gridUrl);
|
78
76
|
const selenoidConfigDir = await createSelenoidConfig(browsers, {
|
79
77
|
useDocker: false
|
@@ -4,18 +4,15 @@ import { createHash } from 'crypto';
|
|
4
4
|
import { mapValues, pick } from 'lodash';
|
5
5
|
import { isDefined, isFunction, isObject } from '../types';
|
6
6
|
import { shouldSkip, removeProps } from './utils';
|
7
|
-
import { isStorybookVersionLessThan } from './storybook/helpers';
|
8
7
|
|
9
8
|
function storyTestFabric(delay, testFn) {
|
10
9
|
return async function storyTest() {
|
11
|
-
var _testFn$call;
|
12
|
-
|
13
10
|
delay ? await new Promise(resolve => setTimeout(resolve, delay)) : void 0;
|
14
|
-
await (
|
11
|
+
await (testFn ? testFn.call(this) : this.screenshots.length > 0 ? this.expect(this.screenshots.reduce((screenshots, {
|
15
12
|
imageName,
|
16
13
|
screenshot
|
17
14
|
}, index) => ({ ...screenshots,
|
18
|
-
[imageName
|
15
|
+
[imageName ?? `screenshot_${index}`]: screenshot
|
19
16
|
}), {})).to.matchImages() : this.expect(await this.takeScreenshot()).to.matchImage());
|
20
17
|
};
|
21
18
|
}
|
@@ -45,15 +42,13 @@ function createCreeveyTest(browser, storyMeta, skipOptions, testName) {
|
|
45
42
|
function convertStories(browserName, stories) {
|
46
43
|
const tests = {};
|
47
44
|
(Array.isArray(stories) ? stories : Object.values(stories)).forEach(storyMeta => {
|
48
|
-
var _storyMeta$parameters;
|
49
|
-
|
50
45
|
// TODO Skip docsOnly stories for now
|
51
46
|
if (storyMeta.parameters.docsOnly) return;
|
52
47
|
const {
|
53
48
|
delay: delayParam,
|
54
49
|
tests: storyTests,
|
55
50
|
skip
|
56
|
-
} =
|
51
|
+
} = storyMeta.parameters.creevey ?? {};
|
57
52
|
const delay = typeof delayParam == 'number' ? delayParam : delayParam !== null && delayParam !== void 0 && delayParam.for.includes(browserName) ? delayParam.ms : 0; // typeof tests === "undefined" => rootSuite -> kindSuite -> storyTest -> [browsers.png]
|
58
53
|
// typeof tests === "function" => rootSuite -> kindSuite -> storyTest -> browser -> [images.png]
|
59
54
|
// typeof tests === "object" => rootSuite -> kindSuite -> storySuite -> test -> [browsers.png]
|
@@ -88,11 +83,11 @@ export async function loadTestsFromStories(browsers, provider, update) {
|
|
88
83
|
const tests = {};
|
89
84
|
browsers.forEach(browser => {
|
90
85
|
Array.from(storiesByFiles.entries()).forEach(([filename, stories]) => {
|
91
|
-
var _testIdsByFiles$get
|
86
|
+
var _testIdsByFiles$get;
|
92
87
|
|
93
88
|
Object.assign(tests, convertStories(browser, stories));
|
94
89
|
const changed = Object.keys(tests);
|
95
|
-
const removed = (
|
90
|
+
const removed = ((_testIdsByFiles$get = testIdsByFiles.get(filename)) === null || _testIdsByFiles$get === void 0 ? void 0 : _testIdsByFiles$get.filter(testId => !tests[testId])) ?? [];
|
96
91
|
if (changed.length == 0) testIdsByFiles.delete(filename);else testIdsByFiles.set(filename, changed);
|
97
92
|
Object.assign(testsDiff, tests);
|
98
93
|
removed.forEach(testId => testsDiff[testId] = undefined);
|
@@ -108,35 +103,24 @@ export async function loadTestsFromStories(browsers, provider, update) {
|
|
108
103
|
fileName
|
109
104
|
}
|
110
105
|
}
|
111
|
-
}) =>
|
112
|
-
|
113
|
-
|
114
|
-
return (// TODO Don't use filename as a key, due possible collisions if two require.context with same structure of modules are defined
|
115
|
-
testIdsByFiles.set(fileName, [...((_testIdsByFiles$get2 = testIdsByFiles.get(fileName)) !== null && _testIdsByFiles$get2 !== void 0 ? _testIdsByFiles$get2 : []), id])
|
116
|
-
);
|
117
|
-
});
|
106
|
+
}) => // TODO Don't use filename as a key, due possible collisions if two require.context with same structure of modules are defined
|
107
|
+
testIdsByFiles.set(fileName, [...(testIdsByFiles.get(fileName) ?? []), id]));
|
118
108
|
return tests;
|
119
109
|
}
|
120
110
|
export function saveStoriesJson(storiesData, extract) {
|
121
|
-
|
122
|
-
|
123
|
-
const outputDir = typeof extract == 'boolean' ? 'storybook-static' : extract;
|
124
|
-
|
125
|
-
if (!isStorybookVersionLessThan(6)) {
|
126
|
-
// NOTE Copy-pasted from Storybook's `getStoriesJsonData` method
|
127
|
-
const allowed = ['fileName', 'docsOnly', 'framework', '__id', '__isArgsStory'];
|
128
|
-
storiesData.globalParameters = pick(storiesData.globalParameters, allowed); // @ts-expect-error ignore error
|
111
|
+
const outputDir = typeof extract == 'boolean' ? 'storybook-static' : extract; // NOTE Copy-pasted from Storybook's `getStoriesJsonData` method
|
129
112
|
|
130
|
-
|
113
|
+
const allowed = ['fileName', 'docsOnly', 'framework', '__id', '__isArgsStory'];
|
114
|
+
storiesData.globalParameters = pick(storiesData.globalParameters, allowed); // @ts-expect-error ignore error
|
131
115
|
|
132
|
-
|
133
|
-
parameters: pick(v.parameters, allowed)
|
134
|
-
}));
|
135
|
-
} // TODO Fix args stories
|
116
|
+
storiesData.kindParameters = mapValues(storiesData.kindParameters, v => pick(v, allowed)); // @ts-expect-error ignore error
|
136
117
|
|
118
|
+
storiesData.stories = mapValues(storiesData.stories, v => ({ ...pick(v, ['id', 'name', 'kind', 'story']),
|
119
|
+
parameters: pick(v.parameters, allowed)
|
120
|
+
})); // TODO Fix args stories
|
137
121
|
|
138
|
-
removeProps(storiesData
|
139
|
-
Object.values((
|
122
|
+
removeProps(storiesData ?? {}, ['stories', () => true, 'parameters', '__isArgsStory']);
|
123
|
+
Object.values((storiesData === null || storiesData === void 0 ? void 0 : storiesData.stories) ?? {}).forEach(story => isObject(story) && 'parameters' in story && isObject(story.parameters) && delete story.parameters.__isArgsStory);
|
140
124
|
mkdirSync(outputDir, {
|
141
125
|
recursive: true
|
142
126
|
});
|