Skip to content

Instantly share code, notes, and snippets.

@Samu31Nd
Created March 8, 2026 01:44
Show Gist options
  • Select an option

  • Save Samu31Nd/5dca956f7453022f0c18870352c3aaf9 to your computer and use it in GitHub Desktop.

Select an option

Save Samu31Nd/5dca956f7453022f0c18870352c3aaf9 to your computer and use it in GitHub Desktop.
Configuration for Node.Js + Typescript optimized for Neo vim
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
// Usamos el preset específico para ESM
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
// Esto es vital para que Jest no se confunda con las extensiones .js en archivos .ts
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
};
{
"watch": ["src"],
"ext": ".ts,.js",
"ignore": [],
"exec": "npx tsx ./src/app.ts"
}
{
"name": "example",
"version": "0.0.1",
"type": "module",
"description": "example app",
"main": "app.ts",
"directories": {
"test": "tests"
},
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"dev": "nodemon",
"build": "rimraf ./dist && tsc",
"start": "node dist/app.js"
},
"license": "ISC",
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^25.3.5",
"jest": "^30.2.0",
"nodemon": "^3.1.14",
"rimraf": "^6.1.3",
"supertest": "^7.2.2",
"ts-jest": "^29.4.6",
"ts-node": "^10.9.2",
"tsx": "^4.21.0",
"typescript": "^5.9.3"
}
}
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext", // Obligatorio para Node + ESM
"moduleResolution": "NodeNext", // Obligatorio si 'module' es NodeNext
"isolatedModules": true,
"rootDir": "src",
"outDir": "dist",
"strict": true,
"skipLibCheck": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true, // Lo que pedía tu error anterior
"sourceMap": true,
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.ts"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment