add cli check
This commit is contained in:
parent
4fb068e6ae
commit
f759c1e83c
|
|
@ -337,6 +337,9 @@ function overridesFromOptions(options: { [key: string]: any }): ConfigCLIOverrid
|
|||
overrides.use = overrides.use || {};
|
||||
overrides.use.trace = options.trace;
|
||||
}
|
||||
if (overrides.tsconfig && !fs.existsSync(overrides.tsconfig))
|
||||
throw new Error(`--tsconfig "${options.tsconfig}" does not exist`);
|
||||
|
||||
return overrides;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -719,14 +719,14 @@ test('should throw on nonexistant config.tsconfig', async ({ runInlineTest }) =>
|
|||
tsconfig: './does-not-exist.json',
|
||||
};
|
||||
`,
|
||||
'tests/a.test.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('test', ({}) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
`,
|
||||
});
|
||||
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain(`config.tsconfig does not exist`);
|
||||
});
|
||||
|
||||
test('should throw on invalid --tsconfig', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({}, { 'tsconfig': 'does-not-exist.json' });
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain(`--tsconfig "does-not-exist.json" does not exist`);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue