Verify latest release
Hermione version
v8.25.4
Last Hermione version that worked
Which area(s) of Hermione are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/BlackPoretsky/testplane-error-ts
Reproduction steps
- Set in
package.json "type": "module"
- Set the extension of the configuration file to
.ts
- Start the
npx testplane
Actual Behavior
The error:
[ERR_REQUIRE_ESM] is selected: import must be used to load the ES module: E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane.config.ts The require() function for ES modules is not supported. require() of E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane.config.ts from E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\node_modules\.pnpm\testplane@8.25.4_@types+node@22.13.14_ts-node@10.9.2_typescript@5.7.3\node_modules\testplane\build\src\config\index.The js is an ES module file, since it is a TS file, the closest parent package file.the json of which contains "type": "module", which defines all ts files in the scope of this package as ES modules. Instead, change the required code using the import() function or remove "type": "module" from E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\package.json .
If you change the configuration file extension to .cts, the tests run, but test files with the extension .ts are not accepted and an error is returned: TypeError: Unknown file extension ".ts" for E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane-tests\example.testplane.ts at Object.get File Protocol Module Format [as file:] (node:internal/modules/esm/get_format:160:9) at defaultGetFormat (node:internal/modules/esm/get_format:203:36) at default Load (node:internal/modules/esm/load:143:22) at async Module Loader.load (node:internal/modules/esm/loader:396:7) at sync Module Loader.module Provider (node:internal/modules/esm/loader:278:45) at async link (node:internal/modules/esm/module_job:78:21)
The system.fileExtensions field in the configuration has not changed.
And if you replace the extension for test files with .js then the tests run successfully, but I would still like to use .ts.
Expected Behavior
The tests should have been run.
Which Node.js version are you using?
20.14.0
Verify latest release
Hermione version
v8.25.4
Last Hermione version that worked
Which area(s) of Hermione are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/BlackPoretsky/testplane-error-ts
Reproduction steps
package.json"type": "module".tsnpx testplaneActual Behavior
The error:
[ERR_REQUIRE_ESM] is selected: import must be used to load the ES module: E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane.config.ts The require() function for ES modules is not supported. require() of E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane.config.ts from E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\node_modules\.pnpm\testplane@8.25.4_@types+node@22.13.14_ts-node@10.9.2_typescript@5.7.3\node_modules\testplane\build\src\config\index.The js is an ES module file, since it is a TS file, the closest parent package file.the json of which contains "type": "module", which defines all ts files in the scope of this package as ES modules. Instead, change the required code using the import() function or remove "type": "module" from E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\package.json .If you change the configuration file extension to
.cts, the tests run, but test files with the extension.tsare not accepted and an error is returned:TypeError: Unknown file extension ".ts" for E:\WEB_LEARN\testplane-error-ts\testplane-error-ts\testplane-tests\example.testplane.ts at Object.get File Protocol Module Format [as file:] (node:internal/modules/esm/get_format:160:9) at defaultGetFormat (node:internal/modules/esm/get_format:203:36) at default Load (node:internal/modules/esm/load:143:22) at async Module Loader.load (node:internal/modules/esm/loader:396:7) at sync Module Loader.module Provider (node:internal/modules/esm/loader:278:45) at async link (node:internal/modules/esm/module_job:78:21)The
system.fileExtensionsfield in the configuration has not changed.And if you replace the extension for test files with
.jsthen the tests run successfully, but I would still like to use.ts.Expected Behavior
The tests should have been run.
Which Node.js version are you using?
20.14.0