Skip to content

Commit d18924b

Browse files
DavertMikDavertMikclaude
authored
fix(init): emit ESM-compatible tsconfig for TypeScript projects (#5596)
`codecept init` installs tsx and sets `require: ['tsx/cjs']`, but the generated tsconfig.json still carried the legacy ts-node setup: - a `"ts-node": { files: true }` block, though ts-node is never installed and is marked "not recommended" in loaderCheck.js - `"module": "commonjs"`, wrong for an ESM ("type": "module") project Generate a tsconfig that matches the tsx/ESM setup init already configures: drop the ts-node block, use `module: ESNext` with `moduleResolution: bundler` (so extensionless imports resolve as tsx/docs expect), and bump target/lib to ES2022. Co-authored-by: DavertMik <davert@testomat.io> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 06cdb0c commit d18924b

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/command/init.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,12 @@ export default async function (initPath, options = {}) {
245245
}
246246

247247
const tsconfig = {
248-
'ts-node': {
249-
files: true,
250-
},
251248
compilerOptions: {
252-
target: 'es2018',
253-
lib: ['es2018', 'DOM'],
249+
target: 'ES2022',
250+
lib: ['ES2022', 'DOM'],
254251
esModuleInterop: true,
255-
module: 'commonjs',
252+
module: 'ESNext',
253+
moduleResolution: 'bundler',
256254
strictNullChecks: false,
257255
types: ['codeceptjs', 'node'],
258256
declaration: true,

0 commit comments

Comments
 (0)