Skip to content

Possible regression with ts-node 10.0.0: ts extension not registered? #1368

Description

@jayaddison

Expected Behavior

For this codebase, running make tests (essentially, npx mocha) runs unit tests over some TypeScript code, and completes successfully. The codebase has ts-node configured matching semver ^9.1.1.

After upgrading the package.json ts-node entry to 10.0.0 in package.json file, and running npm install --also=dev, unit tests should continue to pass.

Actual Behavior

After the upgrade, unit tests fail:

TS_NODE_IGNORE='node_modules/(?!document-prev)' npx mocha

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/jka/Documents/reciperadar/document/src/index.spec.ts
    at new NodeError (node:internal/errors:363:5)
    at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
    at Loader.getFormat (node:internal/modules/esm/loader:105:42)
    at Loader.getModuleJob (node:internal/modules/esm/loader:243:31)
    at Loader.import (node:internal/modules/esm/loader:177:17)
    at importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at formattedImport (/home/jka/Documents/reciperadar/document/node_modules/mocha/lib/esm-utils.js:7:14)
    at Object.exports.loadFilesAsync (/home/jka/Documents/reciperadar/document/node_modules/mocha/lib/esm-utils.js:55:20)
    at singleRun (/home/jka/Documents/reciperadar/document/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at Object.exports.handler (/home/jka/Documents/reciperadar/document/node_modules/mocha/lib/cli/run.js:362:5)
make: *** [Makefile:9: tests] Error 1

Steps to reproduce the problem

Update the devDependency entry for ts-node, reinstall dependencies (including dev), and then run make tests.

Minimal reproduction

I'll attempt to narrow this down and fill in the minimal repro case soon.

Specifications

  • ts-node version: 10.0.0
  • node version: v16.1.0.
  • TypeScript version: v4.3.2
  • tsconfig.json, if you're using one:
{
    "compilerOptions": {
        "resolveJsonModule": true,
        "target": "ES5"
    }
}
  • Operating system and version: Manjaro Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions