Skip to content

Commit 09033d8

Browse files
committed
feat: make updateSnapshotState sync again
1 parent 4531d84 commit 09033d8

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

packages/jest-core/src/TestScheduler.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,29 @@ export default class TestScheduler {
158158
};
159159

160160
const updateSnapshotState = async () => {
161-
await Promise.all(
162-
Array.from(contexts).map(async context => {
163-
const status = snapshot.cleanup(
164-
context.hasteFS,
165-
this._globalConfig.updateSnapshot,
166-
await snapshot.buildSnapshotResolver(context.config),
167-
context.config.testPathIgnorePatterns,
168-
);
169-
170-
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
171-
aggregatedResults.snapshot.filesRemovedList = (
172-
aggregatedResults.snapshot.filesRemovedList || []
173-
).concat(status.filesRemovedList);
174-
}),
161+
const contextsWithSnapshotResolvers = await Promise.all(
162+
Array.from(contexts).map(
163+
async context =>
164+
[
165+
context,
166+
await snapshot.buildSnapshotResolver(context.config),
167+
] as const,
168+
),
175169
);
170+
171+
contextsWithSnapshotResolvers.forEach(([context, snapshotResolver]) => {
172+
const status = snapshot.cleanup(
173+
context.hasteFS,
174+
this._globalConfig.updateSnapshot,
175+
snapshotResolver,
176+
context.config.testPathIgnorePatterns,
177+
);
178+
179+
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
180+
aggregatedResults.snapshot.filesRemovedList = (
181+
aggregatedResults.snapshot.filesRemovedList || []
182+
).concat(status.filesRemovedList);
183+
});
176184
const updateAll = this._globalConfig.updateSnapshot === 'all';
177185
aggregatedResults.snapshot.didUpdate = updateAll;
178186
aggregatedResults.snapshot.failure = !!(

0 commit comments

Comments
 (0)