TypeStrong/ts-node

Using register() with typecheck: false still fails with a type error in test run

MerzDaniel opened this issue · 0 comments

Search Terms

register
typecheck
test

Expected Behavior

When using

const { register } = require('ts-node')
register({ typeCheck: false })

in my .mocharc.js for my mocha test run

I would expect that tests are run without typecheck.

Actual Behavior

The tests don't run, because ts-node early exits on a typecheck error.

This is really blocking the test-driven coding flow. I have a separate script for doing a typecheck&linting before committing changes. When I run tests, I only want to run tests without caring for types

Steps to reproduce the problem

  1. Use
// .mocharc.js
const { register } = require('ts-node')

register({ typeCheck: false })

module.exports = {
  extensions: [
    'ts',
  ],
}
  1. introduce a small typecheck error
  2. run the tests

Specifications

ts-node v10.9.2
node v20.8.1
compiler v5.4.4
  • Operating system and version:
  • Manjaro Linux (rolling release)