fix(only-changed): exit successfully if there were no changes
This commit is contained in:
parent
e17d1c498b
commit
75f39c2d96
|
|
@ -198,7 +198,7 @@ async function runTests(args: string[], opts: { [key: string]: any }) {
|
|||
config.cliGrepInvert = opts.grepInvert as string | undefined;
|
||||
config.cliListOnly = !!opts.list;
|
||||
config.cliProjectFilter = opts.project || undefined;
|
||||
config.cliPassWithNoTests = !!opts.passWithNoTests;
|
||||
config.cliPassWithNoTests = !!(opts.passWithNoTests ?? opts.onlyChanged);
|
||||
config.cliFailOnFlakyTests = !!opts.failOnFlakyTests;
|
||||
|
||||
const runner = new Runner(config);
|
||||
|
|
|
|||
|
|
@ -413,4 +413,20 @@ test('should run project dependencies of changed tests', {
|
|||
expect(result.passed).toBe(1);
|
||||
|
||||
expect(result.output).toContain('setup test is executed');
|
||||
});
|
||||
|
||||
test('exits successfully if there are no changes', async ({ runInlineTest, git, writeFiles }) => {
|
||||
await writeFiles({
|
||||
'a.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
});
|
||||
|
||||
git(`add .`);
|
||||
git(`commit -m init`);
|
||||
|
||||
const result = await runInlineTest({}, { 'only-changed': true });
|
||||
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
Loading…
Reference in a new issue