You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extra: I used nvm for Windows to switch the NodeJS versions.
Console log
C:\Users\psn\Desktop\playwright-module-test> node --version
v16.16.0
C:\Users\psn\Desktop\playwright-module-test> npx playwright test
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
(node:9712) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time(Use `node --trace-warnings ...` to show where the warning was created)
Running 3 tests using 3 workers
3 passed (9s)
To open last HTML report run:
npx playwright show-report
C:\Users\psn\Desktop\playwright-module-test> node --version
v14.20.0
C:\Users\psn\Desktop\playwright-module-test> npx playwright test
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Users\psn\Desktop\playwright-module-test\playwright.config.ts
at new NodeError (internal/errors.js:322:7)
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)
at Loader.getFormat (internal/modules/esm/loader.js:105:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:243:31)
at Loader.import (internal/modules/esm/loader.js:177:17)
at Loader._requireOrImport (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\loader.js:275:28)
at Loader._requireOrImportDefaultObject (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\loader.js:290:18)
at Loader.loadConfigFile (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\loader.js:79:20)
at Runner.loadConfigFromResolvedFile (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\runner.js:96:12)
at runTests (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\cli.js:153:27)
at Ai.<anonymous> (C:\Users\psn\Desktop\playwright-module-test\node_modules\@playwright\test\lib\cli.js:70:7) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
C:\Users\psn\Desktop\playwright-module-test>
Describe the bug
The TypeScript support in combination with "type": "module" seems to be only working in NodeJS >= v16.
Combining TypeScript with "type": "commonjs" also worked in NodeJS v14.
I don't think that this is a big problem as the current LTS version is 16. The documentation in terms of the TypeScript support should be updated I guess so others don't waste time looking for a solution. Currently, the trouble shooting area in the documentation only sets NodeJS v14 as minimum requirement under which this case does not work anymore.
The text was updated successfully, but these errors were encountered:
$ npx playwright test
Running 0 tests using 0 workers
TypeError: Unknown file extension ".ts" for D:\proj\AtlasCopco\EnsoUi\apps\ui-docs-v1\tests\snapshot.spec.ts
at async Promise.all (index 0)
=================
no tests found.
=================
1 error was not a part of any test, see above for details
Only when I remove "type": "module" from package.json it works.
Context
Console log
package.json
Describe the bug
The TypeScript support in combination with
"type": "module"
seems to be only working in NodeJS >= v16.Combining TypeScript with
"type": "commonjs"
also worked in NodeJS v14.I don't think that this is a big problem as the current LTS version is 16. The documentation in terms of the TypeScript support should be updated I guess so others don't waste time looking for a solution. Currently, the trouble shooting area in the documentation only sets NodeJS v14 as minimum requirement under which this case does not work anymore.
The text was updated successfully, but these errors were encountered: