Commit 47c6711
committed
test: explicitly require ts-node/register from both mocharcs
Mocha 10.5+ takes an ESM import() path for .ts spec files on some
Node versions (observed failing on Node 16 with mocha 10.8.2,
ERR_UNKNOWN_FILE_EXTENSION). The ESM path bypasses ts-node/register
which was previously only loaded via nyc.config.js — that only
patches require(), not import().
Adding `require: ['ts-node/register']` to both mocharcs forces mocha
to require the ts-node hook before resolving any specs, which keeps
the CJS loader path active for .ts files regardless of which Node
version is in use.
No impact on published package — tests/ is excluded by .npmignore.
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>1 parent cfa83dd commit 47c6711
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
0 commit comments