chore: remove unnecessary args in ttest (#21012)
This commit is contained in:
parent
56dbd1fcb0
commit
595502ac46
|
|
@ -168,7 +168,6 @@ test('should focus a single nested test spec', async ({ runInlineTest }) => {
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.passed).toBe(2);
|
expect(result.passed).toBe(2);
|
||||||
expect(result.skipped).toBe(0);
|
expect(result.skipped).toBe(0);
|
||||||
console.log(JSON.stringify(result.report, null, 2));
|
|
||||||
expect(result.report.suites[0].specs[0].title).toEqual('pass3');
|
expect(result.report.suites[0].specs[0].title).toEqual('pass3');
|
||||||
expect(result.report.suites[1].suites[0].suites[0].specs[0].title).toEqual('pass2');
|
expect(result.report.suites[1].suites[0].suites[0].specs[0].title).toEqual('pass2');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -86,11 +86,8 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
||||||
paramList.push(params[key] === true ? `${k}` : `${k}=${value}`);
|
paramList.push(params[key] === true ? `${k}` : `${k}=${value}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const outputDir = path.join(baseDir, 'test-results');
|
const reportFile = path.join(baseDir, 'report.json');
|
||||||
const reportFile = path.join(outputDir, 'report.json');
|
|
||||||
const args = ['test'];
|
const args = ['test'];
|
||||||
if (!options.usesCustomReporters)
|
|
||||||
args.push('--reporter=dot,json');
|
|
||||||
args.push(
|
args.push(
|
||||||
'--workers=2',
|
'--workers=2',
|
||||||
...paramList
|
...paramList
|
||||||
|
|
@ -101,6 +98,7 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
||||||
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let { exitCode, output } = await runPlaywrightCommand(childProcess, cwd, args, {
|
let { exitCode, output } = await runPlaywrightCommand(childProcess, cwd, args, {
|
||||||
|
PW_TEST_REPORTER: path.join(__dirname, '../../packages/playwright-test/lib/reporters/json.js'),
|
||||||
PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,
|
PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,
|
||||||
...env,
|
...env,
|
||||||
}, options.sendSIGINTAfter);
|
}, options.sendSIGINTAfter);
|
||||||
|
|
@ -158,11 +156,7 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchPlaywrightTest(childProcess: CommonFixtures['childProcess'], baseDir: string, env: NodeJS.ProcessEnv, options: RunOptions): TestChildProcess {
|
function watchPlaywrightTest(childProcess: CommonFixtures['childProcess'], baseDir: string, env: NodeJS.ProcessEnv, options: RunOptions): TestChildProcess {
|
||||||
const paramList: string[] = [];
|
const args = ['test', '--workers=2'];
|
||||||
const outputDir = path.join(baseDir, 'test-results');
|
|
||||||
const args = ['test'];
|
|
||||||
args.push('--output=' + outputDir);
|
|
||||||
args.push('--workers=2', ...paramList);
|
|
||||||
if (options.additionalArgs)
|
if (options.additionalArgs)
|
||||||
args.push(...options.additionalArgs);
|
args.push(...options.additionalArgs);
|
||||||
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
||||||
|
|
@ -224,7 +218,6 @@ function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||||
|
|
||||||
type RunOptions = {
|
type RunOptions = {
|
||||||
sendSIGINTAfter?: number;
|
sendSIGINTAfter?: number;
|
||||||
usesCustomReporters?: boolean;
|
|
||||||
additionalArgs?: string[];
|
additionalArgs?: string[];
|
||||||
cwd?: string,
|
cwd?: string,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,6 @@ test('should work with screenshot: on', async ({ runInlineTest }, testInfo) => {
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' test-failed-1.png',
|
' test-failed-1.png',
|
||||||
' test-failed-2.png',
|
' test-failed-2.png',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -185,7 +184,6 @@ test('should work with screenshot: only-on-failure', async ({ runInlineTest }, t
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' test-failed-1.png',
|
' test-failed-1.png',
|
||||||
' test-failed-2.png',
|
' test-failed-2.png',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -210,7 +208,6 @@ test('should work with screenshot: only-on-failure & fullPage', async ({ runInli
|
||||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||||
'artifacts-should-fail-and-take-fullPage-screenshots',
|
'artifacts-should-fail-and-take-fullPage-screenshots',
|
||||||
' test-failed-1.png',
|
' test-failed-1.png',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
const screenshotFailure = fs.readFileSync(
|
const screenshotFailure = fs.readFileSync(
|
||||||
testInfo.outputPath('test-results', 'artifacts-should-fail-and-take-fullPage-screenshots', 'test-failed-1.png')
|
testInfo.outputPath('test-results', 'artifacts-should-fail-and-take-fullPage-screenshots', 'test-failed-1.png')
|
||||||
|
|
@ -252,7 +249,6 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' trace-1.zip',
|
' trace-1.zip',
|
||||||
' trace.zip',
|
' trace.zip',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -279,7 +275,6 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, test
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' trace-1.zip',
|
' trace-1.zip',
|
||||||
' trace.zip',
|
' trace.zip',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -306,7 +301,6 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInf
|
||||||
'artifacts-two-contexts-failing-retry1',
|
'artifacts-two-contexts-failing-retry1',
|
||||||
' trace-1.zip',
|
' trace-1.zip',
|
||||||
' trace.zip',
|
' trace.zip',
|
||||||
'report.json',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ test('should stop tracing on requestContex.dispose()', async ({ runInlineTest, s
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `
|
||||||
module.exports = {
|
module.exports = {
|
||||||
reporter: 'html',
|
reporter: [['html', { open: 'never' }]],
|
||||||
use: {
|
use: {
|
||||||
browserName: 'firefox',
|
browserName: 'firefox',
|
||||||
trace:'retain-on-failure'
|
trace:'retain-on-failure'
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ test('render expected', async ({ runInlineTest }) => {
|
||||||
expect(1).toBe(1);
|
expect(1).toBe(1);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
}, { reporter: 'dot' });
|
||||||
expect(result.rawOutput).toContain(colors.green('·'));
|
expect(result.rawOutput).toContain(colors.green('·'));
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
@ -38,7 +38,7 @@ test('render unexpected', async ({ runInlineTest }) => {
|
||||||
expect(1).toBe(0);
|
expect(1).toBe(0);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
}, { reporter: 'dot' });
|
||||||
expect(result.rawOutput).toContain(colors.red('F'));
|
expect(result.rawOutput).toContain(colors.red('F'));
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
@ -51,7 +51,7 @@ test('render unexpected after retry', async ({ runInlineTest }) => {
|
||||||
expect(1).toBe(0);
|
expect(1).toBe(0);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
}, { retries: 3 });
|
}, { retries: 3, reporter: 'dot' });
|
||||||
const text = result.output;
|
const text = result.output;
|
||||||
expect(text).toContain('×××F');
|
expect(text).toContain('×××F');
|
||||||
expect(result.rawOutput).toContain(colors.red('F'));
|
expect(result.rawOutput).toContain(colors.red('F'));
|
||||||
|
|
@ -66,7 +66,7 @@ test('render flaky', async ({ runInlineTest }) => {
|
||||||
expect(testInfo.retry).toBe(3);
|
expect(testInfo.retry).toBe(3);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
}, { retries: 3 });
|
}, { retries: 3, reporter: 'dot' });
|
||||||
const text = result.output;
|
const text = result.output;
|
||||||
expect(text).toContain('×××±');
|
expect(text).toContain('×××±');
|
||||||
expect(result.rawOutput).toContain(colors.yellow('±'));
|
expect(result.rawOutput).toContain(colors.yellow('±'));
|
||||||
|
|
@ -86,7 +86,7 @@ test('should work from config', async ({ runInlineTest }) => {
|
||||||
expect(1).toBe(1);
|
expect(1).toBe(1);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
}, { reporter: 'dot' });
|
||||||
expect(result.rawOutput).toContain(colors.green('·'));
|
expect(result.rawOutput).toContain(colors.green('·'));
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
@ -99,7 +99,7 @@ test('render 243 tests in rows by 80', async ({ runInlineTest }) => {
|
||||||
test('test' + i, () => {});
|
test('test' + i, () => {});
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
});
|
}, { reporter: 'dot' });
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.rawOutput).toContain(
|
expect(result.rawOutput).toContain(
|
||||||
colors.green('·').repeat(80) + '\n' +
|
colors.green('·').repeat(80) + '\n' +
|
||||||
|
|
|
||||||
|
|
@ -914,7 +914,7 @@ test('should report clashing folders', async ({ runInlineTest }) => {
|
||||||
test('passes', async ({}) => {
|
test('passes', async ({}) => {
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
}, {}, {}, { usesCustomReporters: true });
|
});
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
const output = result.output;
|
const output = result.output;
|
||||||
expect(output).toContain('Configuration Error');
|
expect(output).toContain('Configuration Error');
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ test('should retry timeout', async ({ runInlineTest }) => {
|
||||||
await new Promise(f => setTimeout(f, 10000));
|
await new Promise(f => setTimeout(f, 10000));
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { timeout: 1000, retries: 2 });
|
}, { timeout: 1000, retries: 2, reporter: 'dot' });
|
||||||
expect(exitCode).toBe(1);
|
expect(exitCode).toBe(1);
|
||||||
expect(passed).toBe(0);
|
expect(passed).toBe(0);
|
||||||
expect(failed).toBe(1);
|
expect(failed).toBe(1);
|
||||||
|
|
@ -154,7 +154,7 @@ test('should retry unexpected pass', async ({ runInlineTest }) => {
|
||||||
expect(1 + 1).toBe(2);
|
expect(1 + 1).toBe(2);
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { retries: 2 });
|
}, { retries: 2, reporter: 'dot' });
|
||||||
expect(exitCode).toBe(1);
|
expect(exitCode).toBe(1);
|
||||||
expect(passed).toBe(0);
|
expect(passed).toBe(0);
|
||||||
expect(failed).toBe(1);
|
expect(failed).toBe(1);
|
||||||
|
|
@ -174,7 +174,7 @@ test('should not retry expected failure', async ({ runInlineTest }) => {
|
||||||
expect(1 + 1).toBe(2);
|
expect(1 + 1).toBe(2);
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { retries: 2 });
|
}, { retries: 2, reporter: 'dot' });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
expect(passed).toBe(2);
|
expect(passed).toBe(2);
|
||||||
expect(failed).toBe(0);
|
expect(failed).toBe(0);
|
||||||
|
|
@ -192,7 +192,7 @@ test('should retry unhandled rejection', async ({ runInlineTest }) => {
|
||||||
await new Promise(f => setTimeout(f, 2000));
|
await new Promise(f => setTimeout(f, 2000));
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { retries: 2 });
|
}, { retries: 2, reporter: 'dot' });
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.passed).toBe(0);
|
expect(result.passed).toBe(0);
|
||||||
expect(result.failed).toBe(1);
|
expect(result.failed).toBe(1);
|
||||||
|
|
@ -212,7 +212,7 @@ test('should retry beforeAll failure', async ({ runInlineTest }) => {
|
||||||
test('another passing test', async () => {
|
test('another passing test', async () => {
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { retries: 2 });
|
}, { retries: 2, reporter: 'dot' });
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.passed).toBe(0);
|
expect(result.passed).toBe(0);
|
||||||
expect(result.failed).toBe(1);
|
expect(result.failed).toBe(1);
|
||||||
|
|
@ -236,7 +236,7 @@ test('should retry worker fixture setup failure', async ({ runInlineTest }) => {
|
||||||
test('passing test', async ({ worker }) => {
|
test('passing test', async ({ worker }) => {
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { retries: 2 });
|
}, { retries: 2, reporter: 'dot' });
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.passed).toBe(0);
|
expect(result.passed).toBe(0);
|
||||||
expect(result.failed).toBe(1);
|
expect(result.failed).toBe(1);
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ test('should default to package.json directory', async ({ runInlineTest }, testI
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'foo/package.json': `{ "name": "foo" }`,
|
'foo/package.json': `{ "name": "foo" }`,
|
||||||
'foo/bar/playwright.config.js': `
|
'foo/bar/playwright.config.js': `
|
||||||
module.exports = { projects: [ {} ] };
|
module.exports = { reporters: [], projects: [ {} ] };
|
||||||
`,
|
`,
|
||||||
'foo/bar/baz/tests/a.spec.js': `
|
'foo/bar/baz/tests/a.spec.js': `
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
@ -97,7 +97,7 @@ test('should default to package.json directory', async ({ runInlineTest }, testI
|
||||||
fs.writeFileSync(testInfo.outputPath('foo.ts'), 'foobar');
|
fs.writeFileSync(testInfo.outputPath('foo.ts'), 'foobar');
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { 'reporter': '' }, {}, {
|
}, {}, { PW_TEST_REPORTER: '' }, {
|
||||||
cwd: 'foo/bar/baz/tests',
|
cwd: 'foo/bar/baz/tests',
|
||||||
});
|
});
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue