mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(test-runner): do only match JS/TS files when collecting (#7014)
This commit is contained in:
parent
144ef2a72d
commit
05382c997b
@ -143,7 +143,8 @@ export class Runner {
|
||||
const allFiles = await collectFiles(project.config.testDir);
|
||||
const testMatch = createMatcher(project.config.testMatch);
|
||||
const testIgnore = createMatcher(project.config.testIgnore);
|
||||
const testFiles = allFiles.filter(file => !testIgnore(file) && testMatch(file) && testFileFilter(file));
|
||||
const testFileExtension = (file: string) => ['.js', '.ts'].includes(path.extname(file));
|
||||
const testFiles = allFiles.filter(file => !testIgnore(file) && testMatch(file) && testFileFilter(file) && testFileExtension(file));
|
||||
files.set(project, testFiles);
|
||||
testFiles.forEach(file => allTestFiles.add(file));
|
||||
}
|
||||
|
||||
@ -259,4 +259,25 @@ test('should ignore node_modules even with custom testIgnore', async ({ runInlin
|
||||
});
|
||||
expect(result.passed).toBe(1);
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
test('should only match files with JS/TS file extensions', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'playwright.config.ts': `
|
||||
module.exports = { testMatch: /foobar/ };
|
||||
`,
|
||||
'foobar.test.ts': `
|
||||
const { test } = pwt;
|
||||
test('pass', ({}) => {});
|
||||
`,
|
||||
'foobar.test.js': `
|
||||
const { test } = pwt;
|
||||
test('pass', ({}) => {});
|
||||
`,
|
||||
'foobar.test.ts-snapshots/compares-page-screenshot-chromium-linux-test-chromium.png': `
|
||||
<S0MeTh1ngN0nPArsAble!
|
||||
`
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(2);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user