-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Using array of reporter types fails typescript validation: "Type 'string[]' is not assignable to type 'ReporterDescription'" #33708
Comments
@asos-tomp Could you please share your |
This is running in a github actions workflow, using an npm script thus:
...with that config thus: import { devices, defineConfig } from "@playwright/test";
export default defineConfig({
fullyParallel: true,
forbidOnly: !!process.env.CI,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? [["blob"], ["github"]] : [["list"], ["html"]],
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
testDir: "./examples/next/src/app/fixtures",
use: {
baseURL: "http://localhost:3000/fixtures/"
},
webServer: {
command: "npm run build && npm run start",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
}
}); |
@asos-tomp Could you still share your
It seems like the |
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": ".",
"target": "es2018",
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"module": "esnext",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
".next/types/**/*.ts",
"**/*.ts",
"**/*.tsx",
"playwright.config.ts"
],
"exclude": [
"node_modules"
]
}
This is a vanilla Next.js example application, with bare bones configuration, containing the playwright config in the root.
OK thanks. I guess the fact the IDE is showing this error, irrespective of the contents of the If I remove
|
@asos-tomp Unfortunately, I still cannot reproduce the problem, even with your |
I've reproduced on stackblitz here. The type failure only shows when a config is imported from a workspace and spread to the |
@asos-tomp Thank you, this is a nice repro. Indeed, TypeScript would complain because you widen the type by spreading through an object with an inferred type. You can narrow the type back like this in the import { ReporterDescription } from '@playwright/test';
const config = {
reporter: [['list'], ['html']] as ReporterDescription[],
};
export default config; Alternatively, when import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
reporter: [['list'], ['html']],
};
export default config; Let me know whether this helps. |
I have tried the first suggestion here: https://stackblitz.com/edit/github-6jrsge-txnqvw which has resolve the problem on the stackblitz, It does confuse me since The latter suggestion also makes sense, but sadly the design includes the |
Version
1.49.0
Steps to reproduce
Create a config with multiple reporters thus:
reporter: [["list"], ["html"]]
Expected behavior
With a javascript config, everything runs and multiple reports produced.
Actual behavior
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: