Skip to content

Commit

Permalink
fix(runner): sort test imports to make the output stable
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperStrike committed Oct 27, 2023
1 parent 47ea710 commit 86ed5b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,13 @@ export default class Runner implements Disposable {
setup: (pluginBuild) => {
pluginBuild.onResolve({ filter: /^<stdin>$/ }, () => ({ path: 'stdin', namespace: 'wrightplay' }));
pluginBuild.onLoad({ filter: /^/, namespace: 'wrightplay' }, async () => {
// Sort to make the output stable
const importFiles = await testFinder.getFiles();
importFiles.sort();

// Prepend the setup file if any
if (setupFile) importFiles.unshift(setupFile.replace(/\\/g, '\\\\'));

if (importFiles.length === 0) {
if (watch) {
// eslint-disable-next-line no-console
Expand All @@ -266,6 +271,7 @@ export default class Runner implements Disposable {
throw new Error('No test file found');
}
}

const importStatements = importFiles.map((file) => `import '${file}'`).join('\n');
return {
contents: `${importStatements}\n(${clientRunner.init.toString()})('${this.uuid}')`,
Expand Down

0 comments on commit 86ed5b5

Please sign in to comment.