config validation
This commit is contained in:
parent
0baadb513b
commit
cdd202fe98
|
|
@ -254,6 +254,11 @@ function validateConfig(file: string, config: Config) {
|
|||
else if (typeof config.workers === 'string' && !config.workers.endsWith('%'))
|
||||
throw errorWithFile(file, `config.workers must be a number or percentage`);
|
||||
}
|
||||
|
||||
if ('tsconfig' in config && config.tsconfig !== undefined) {
|
||||
if (typeof config.tsconfig !== 'string')
|
||||
throw errorWithFile(file, `config.tsconfig must be a string`);
|
||||
}
|
||||
}
|
||||
|
||||
function validateProject(file: string, project: Project, title: string) {
|
||||
|
|
|
|||
|
|
@ -734,6 +734,19 @@ test('should respect config.tsconfig option', async ({ runInlineTest }) => {
|
|||
expect(result.output).not.toContain(`Could not`);
|
||||
});
|
||||
|
||||
test('should throw on invalid config.tsconfig option', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'playwright.config.ts': `
|
||||
export default {
|
||||
tsconfig: true,
|
||||
};
|
||||
`,
|
||||
});
|
||||
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain(`config.tsconfig must be a string`);
|
||||
});
|
||||
|
||||
test.describe('directory imports', () => {
|
||||
test('should resolve index.js without path mapping in CJS', async ({ runInlineTest, runTSC }) => {
|
||||
const files = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue