Open karlhorky opened 3 months ago
There are also 26 other type errors from the tests-examples/demo-todo-app.spec.ts file, but that probably deserves a different, separate issue to fix:
Would it be possible to share your tsconfig with us? Curious how you ended up with the errors.
Running tsc to check TypeScript types after running create-playwright leads to many errors, with large errors coming from the .js files inside playwright-report:
tsconfigs are specific to projects - some use extends, some include, some exclude some rootDir. create-playwright works for most projects while this would be outside of the scope and the user would need to make this adjustment on his own.
Would it be possible to share your tsconfig with us?
Sure, see below:
tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"target": "ES2015",
"module": "Preserve",
"moduleDetection": "force",
"resolveJsonModule": true,
"esModuleInterop": true,
"isolatedModules": true,
"checkJs": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"strict": true,
"incremental": true,
"noUncheckedIndexedAccess": true
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"**/*.cjs",
"**/*.mjs",
".next/types/**/*.ts"
],
"exclude": ["node_modules", "build"]
}
I also created a reproduction repo along with a failing GitHub Actions workflow (Gist of workflow test run logs) and linked in the original issue description above, my steps:
tsconfigs are specific to projects - some use extends, some include, some exclude some rootDir
Agreed, not every config can be supported
But checking .some(excludeEntry => excludeEntry === 'playwright-report')
and then doing .push('playwright-report')
to the exclude
array in tsconfig.json
would be:
create-*
tools)playwright-report
to .gitignore
create-playwright works for most projects
This is what I'm challenging - I assert that:
create-playwright
does not work for most TypeScript projects, as it does not work for the config above which is not an uncommon configcreate-playwright
does not do anything to TypeScript projects to prevent type errors with files that it creates out of the boxcreate-playwright
should work with common TypeScript configurations out of the box.
Version
1.44.1
Steps to reproduce
pnpm create playwright
in acheckJs
TypeScript project (project hastypescript
installed andtsconfig.json
file withcheckJs: true
)pnpm playwright test --ui
and run one of the testspnpm tsc
/playwright-report/
directoryExpected behavior
Running
tsc
to check TypeScript types after runningcreate-playwright
should lead to zero errors:One way of achieving this would be:
"exclude"
configuration intsconfig.json
file could be written to with the default pathplaywright-report
create-playwright
should ask for the location of the reports folder and use that in thetsconfig.json
exclude
config (because this path is configurable usingreporter[number][1].outputFolder
)Actual behavior
Running
tsc
to check TypeScript types after runningcreate-playwright
leads to many errors, with large errors coming from the.js
files insideplaywright-report
:There are also 26 other type errors from the
tests-examples/demo-todo-app.spec.ts
file, but that probably deserves a different, separate issue to fix:I also created:
Additional context
No response
Environment