Skip to content

Commit

Permalink
fix: detect file changes on Windows (#234)
Browse files Browse the repository at this point in the history
closes #233
  • Loading branch information
SEWeiTung authored Jun 3, 2023
1 parent aa5f466 commit 38f1c6c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/cmd/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class TestCommand extends BaseCommand {
pattern = process.env.TESTS.split(',');
}

// collect test files
// collect test files when nothing is changed
if (!pattern.length) {
pattern = [ `test/**/*.test.${ext}` ];
}
Expand Down Expand Up @@ -196,10 +196,15 @@ export class TestCommand extends BaseCommand {
const res = await getChangedFilesForRoots([ path.join(dir, 'test') ], {});
const changedFiles = res.changedFiles;
const files: string[] = [];
for (const file of changedFiles) {
for (let cf of changedFiles) {
// only find test/**/*.test.(js|ts)
if (file.endsWith(`.test.${ext}`)) {
files.push(file);
if (cf.endsWith(`.test.${ext}`)) {
// Patterns MUST use forward slashes (not backslashes)
// This should be converted on Windows
if (process.platform === 'win32') {
cf = cf.replace(/\\/g, '/');
}
files.push(cf);
}
}
return files;
Expand Down

1 comment on commit 38f1c6c

@vercel
Copy link

@vercel vercel bot commented on 38f1c6c Jun 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

egg-bin – ./

egg-bin-no-veronica.vercel.app
egg-bin.vercel.app
egg-bin-git-master-no-veronica.vercel.app

Please sign in to comment.