gemini-testing / gemini-testing/testplane

Unable to read config from path testplane.config.ts

Open
#1,068 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
830
Forks
76
Avg merge
4d 10h
Merged PRs (30d)
14

Description

### Verify latest release

- [x] I verified that the issue exists in the latest Hermione 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

1. Set in `package.json` `"type": "module"`
2. Set the extension of the configuration file to `.ts`
3. 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.