MCPcopy
hub / github.com/codeceptjs/CodeceptJS / getTSNodeESMWarning

Function getTSNodeESMWarning

lib/utils/loaderCheck.js:114–135  ·  view source on GitHub ↗
(requiredModules = [])

Source from the content-addressed store, hash-verified

112 * @returns {string|null} Warning message or null
113 */
114export function getTSNodeESMWarning(requiredModules = []) {
115 if (!requiredModules.includes('ts-node/esm')) {
116 return null
117 }
118
119 return `
120⚠️ Warning: ts-node/esm with "module": "esnext" requires explicit file extensions in all imports.
121
122This is a known limitation. Use tsx/cjs instead to write imports without extensions.
123
124Examples:
125
126 ❌ Incorrect (will fail):
127 import loginPage from "./pages/Login";
128
129 ✅ Correct (must include .ts extension):
130 import loginPage from "./pages/Login.ts";
131
132📚 Documentation: https://codecept.io/typescript
133
134`
135}
136
137/**
138 * Check if user is trying to run TypeScript tests without proper loader

Callers 1

runMethod · 0.90

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected