Closed MikeDabrowski closed 4 months ago
Our bad, this part of the documentation is not up-to-date. Your have to replace the 2 import lines by the following one :
const { Given, When, Then } = require('@cucumber/cucumber');
const { expect } = require('@playwright/test');
I'll update the documentation
Ouch, I am not sure if this is the right way to go. The tsconfig is clearly not used. Could you double check ts-node is being given it as a param?
Yes, you're right ! Here is the best solution with composite tsconfig file : tsconfig.json
{
"references": [
{ "path": "./tsconfig.e2e.json" },
{ "path": "./tsconfig.app.json" }
]
}
tsconfig.app.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"strict": true,
"strictNullChecks": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"lib": [
"es2019",
"es2018",
"es2015",
"dom", "ES2020.Intl"
],
"plugins": [
{
"name": "typescript-tslint-plugin",
"alwaysShowRuleFailuresAsWarnings": false,
"ignoreDefinitionFiles": true
}
],
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"useDefineForClassFields": false,
"composite": true
},
"angularCompilerOptions": {
"preserveWhitespaces": false,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
},
"allowSyntheticDefaultImports": true,
"include": [
"src"
]
}
tsconfig.e2e.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "./out-tsc/app",
"types": [
"@uuv/playwright"
]
},
"include": [
"uuv/cucumber/step_definitions/**/*.ts"
],
"references": [
{ "path": "./tsconfig.app.json" }
]
}
I found this piece. I suspect this might be just for running the tests on UUV itself but if similar pattern (not parameterised tsconfig location) is used in other places it may be the issue. I did not find any other place where ts-node config could be used...
Nah this solution is not viable for us. I spend whole week trying to convert the project to use it but still keeps failing.
Latest issue is that
Error: error TS6304: Composite projects may not disable declaration emit.
despite declaration: true
We will abandon uuv for now.
Describe the bug I followed the docs but I am getting error "SyntaxError: Cannot use import statement outside a module",
<Unable to read "C:\Users\AHTI\IdeaProjects\uuv-test\node_modules\ts-node\src\index.ts">
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected the tsconfig.e2e to be respected. It seems tests only run without tsconfig or when the config that is specified in the docs is the only config there.
I tried keeping my adv config and putting .e2e version next to it or in uuv folder. And as soon as I remove my config tests start working.
possible hints The error suggests that module resolution might be broken. And indeed - if I put
"module": "commonjs",
in my advanced config (and remove all other tsconfigs) the tests are running. This hints that the uuv/playwright does not read thetsconfig.e2e.json
file and defaults to baseline.Screenshots
Desktop (please complete the following information):
Additional context Archive with repro
uuv-test.zip