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.cliGrepInvert = opts.grepInvert as string | undefined;
|
||||||
config.cliListOnly = !!opts.list;
|
config.cliListOnly = !!opts.list;
|
||||||
config.cliProjectFilter = opts.project || undefined;
|
config.cliProjectFilter = opts.project || undefined;
|
||||||
config.cliPassWithNoTests = !!opts.passWithNoTests;
|
config.cliPassWithNoTests = !!(opts.passWithNoTests ?? opts.onlyChanged);
|
||||||
config.cliFailOnFlakyTests = !!opts.failOnFlakyTests;
|
config.cliFailOnFlakyTests = !!opts.failOnFlakyTests;
|
||||||
|
|
||||||
const runner = new Runner(config);
|
const runner = new Runner(config);
|
||||||
|
|
|
||||||
|
|
@ -414,3 +414,19 @@ test('should run project dependencies of changed tests', {
|
||||||
|
|
||||||
expect(result.output).toContain('setup test is executed');
|
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