chore: add test for --only-changed with project dependencies
This commit is contained in:
parent
236a8ac2ac
commit
2d678869c9
|
|
@ -364,4 +364,46 @@ test('UI mode is not supported', async ({ runInlineTest }) => {
|
|||
const result = await runInlineTest({}, { 'only-changed': true, 'ui': true });
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain('--only-changed is not supported in UI mode');
|
||||
});
|
||||
|
||||
test('should run project dependencies of changed tests', async ({ runInlineTest, git, writeFiles }) => {
|
||||
await writeFiles({
|
||||
'playwright.config.ts': `
|
||||
module.exports = {
|
||||
projects: [
|
||||
{ name: 'setup', testMatch: 'setup.ts', },
|
||||
{ name: 'main', dependencies: ['setup'] },
|
||||
],
|
||||
};
|
||||
`,
|
||||
'setup.ts': `
|
||||
console.log("setup is run")
|
||||
`,
|
||||
'a.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
'b.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
});
|
||||
|
||||
git(`add .`);
|
||||
git(`commit -m init`);
|
||||
|
||||
const result = await runInlineTest({
|
||||
'c.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`
|
||||
}, { 'only-changed': true });
|
||||
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
expect(result.passed).toBe(0);
|
||||
|
||||
console.log(result.output);
|
||||
expect(result.output).toContain('setup is run');
|
||||
expect(result.output).toContain('c.spec.ts');
|
||||
});
|
||||
Loading…
Reference in a new issue