Skip to content

mocha + ts-node hangs with node 16 #1462

@cvlmtg

Description

@cvlmtg

I've setup mocha to run some TS tests with ts-node and under node 14 everything runs smoothly, but under node 16 it executes the tests and then hangs forever, so I have to press ctrl-c to get back to the shell prompt.

Search Terms

  • node 16
  • node16
  • mocha

Expected Behavior

mocha completes its operation under node 16 as it does with node 14

Actual Behavior

when run under node 16 all tests are executed but then mocha hangs forever

Schermata 2021-09-16 alle 15 23 49

Schermata 2021-09-16 alle 15 24 11

Steps to reproduce the problem

just run yarn test

Minimal reproduction

TypeStrong/ts-node-repros#18

Specifications

ts-node v10.2.1
node v16.9.1
compiler v4.4.3

{
  "include": [ "src", "types" ],
  "compilerOptions": {
    "module": "esnext",
    "lib": [ "dom", "esnext" ],
    "importHelpers": true,
    "declaration": true,
    "sourceMap": true,
    "rootDir": "./src",
    "strict": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "moduleResolution": "node",
    "jsx": "react",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true
  },
  "ts-node": {
    "compilerOptions": {
      "module": "commonjs"
    },
    "transpileOnly": true
  }
}
  • Operating system and version: macOS 11.5.2, iTerm2 3.4.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions