Skip to content

Commit 17a815e

Browse files
committed
pass the snapshot to all required submodules
1 parent 0e723fa commit 17a815e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/selianize/src/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ import CommandEmitter from "./command";
2222
import LocationEmitter from "./location";
2323
import config from "./config";
2424

25-
export default function Selianize(project, _opts) {
25+
export default function Selianize(project, _opts, snapshot = {}) {
2626
const options = { ...config, ..._opts };
2727
return new Promise(async (res, rej) => { // eslint-disable-line no-unused-vars
28-
const configuration = await ConfigurationEmitter.emit(project, options);
28+
const configuration = await ConfigurationEmitter.emit(project, options, snapshot.globalConfig ? snapshot.globalConfig.snapshot : undefined);
2929

3030
let errors = [];
31-
const tests = (await Promise.all(project.tests.map((test) => TestCaseEmitter.emit(test, options).catch(e => {
32-
errors.push(e);
33-
}))));
31+
const tests = (await Promise.all(project.tests.map((test) =>
32+
TestCaseEmitter.emit(test, options, snapshot.tests ? snapshot.tests.find((snapshotTest) => (test.id === snapshotTest.id)).snapshot : undefined).catch(e => {
33+
errors.push(e);
34+
})
35+
)));
3436

3537
if (errors.length) {
3638
return rej({ name: project.name, tests: errors });
@@ -40,7 +42,9 @@ export default function Selianize(project, _opts) {
4042
map[test.id] = tests[index];
4143
return map;
4244
}, {});
43-
const suites = (await Promise.all(project.suites.map((suite) => SuiteEmitter.emit(suite, testsHashmap, options))));
45+
const suites = (await Promise.all(project.suites.map((suite) =>
46+
SuiteEmitter.emit(suite, testsHashmap, options, snapshot.suites ? snapshot.suites.find((snapshotSuite) => (suite.name === snapshotSuite.name)).snapshot : undefined)
47+
)));
4448

4549
const emittedTests = tests.filter((test) => (!!test.id)).map((test) => ({
4650
id: test.id,

0 commit comments

Comments
 (0)