Context:
- Playwright Version: 1.22.2
- Operating System: Windows
- Node.js version: 14.18
- Browser: All
Code Snippet
Test file
// tests/example.test.ts
import { test } from '@playwright/test'
test('test', async () => {})
Playwright Config
// playwright.config.ts
import { PlaywrightTestConfig } from "@playwright/test";
const playwrightTestConfig: PlaywrightTestConfig = {
use: {
trace: undefined,
},
};
export default playwrightTestConfig;
Describe the bug
Running the above throws this error:
Running 1 test using 1 worker
✘ test/example.test.ts:4:1 › test (4ms)
1) test/example.test.ts:4:1 › test ==================================================================
TypeError: Cannot read property 'mode' of undefined
1 failed
test/example.test.ts:4:1 › test ===================================================================
This is caused by having use,trace as undefined in the playwright config.
This used to work with Playwright v1.19, and given the types of the option (trace?: ...), it should be allowed.
After you figure out what the problem actually is, it is not a big deal as you can simply set the option to off instead of undefined. But it did take me a while to find that the trace option was causing it, as there is no stack trace in the error.
I got this right after upgrading to v1.21, and the reason the option is undefined is that I was setting it conditionally.
Context:
Code Snippet
Test file
Playwright Config
Describe the bug
Running the above throws this error:
This is caused by having
use,traceas undefined in the playwright config.This used to work with Playwright
v1.19, and given the types of the option (trace?: ...), it should be allowed.After you figure out what the problem actually is, it is not a big deal as you can simply set the option to
offinstead ofundefined. But it did take me a while to find that the trace option was causing it, as there is no stack trace in the error.I got this right after upgrading to
v1.21, and the reason the option is undefined is that I was setting it conditionally.