fix(test runner): allow dot-files and dot-directories with tests (#8751)
This commit is contained in:
parent
e914f6bbc7
commit
3739113e74
|
|
@ -112,9 +112,7 @@ export function createMatcher(patterns: string | RegExp | (string | RegExp)[]):
|
|||
return true;
|
||||
}
|
||||
for (const pattern of filePatterns) {
|
||||
if (minimatch(value, pattern, {
|
||||
nocase: true,
|
||||
}))
|
||||
if (minimatch(value, pattern, { nocase: true, dot: true }))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -390,3 +390,31 @@ test('should only match files with JS/TS file extensions', async ({ runInlineTes
|
|||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(2);
|
||||
});
|
||||
|
||||
test('should match dot-files', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'.a.test.ts': `
|
||||
const { test } = pwt;
|
||||
test('pass', ({}) => {});
|
||||
`,
|
||||
});
|
||||
expect(result.passed).toBe(1);
|
||||
expect(result.report.suites.map(s => s.file).sort()).toEqual(['.a.test.ts']);
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('should match in dot-directories', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'.dir/a.test.ts': `
|
||||
const { test } = pwt;
|
||||
test('pass', ({}) => {});
|
||||
`,
|
||||
'.dir/b.test.js': `
|
||||
const { test } = pwt;
|
||||
test('pass', ({}) => {});
|
||||
`,
|
||||
});
|
||||
expect(result.passed).toBe(2);
|
||||
expect(result.report.suites.map(s => s.file).sort()).toEqual(['.dir/a.test.ts', '.dir/b.test.js']);
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue