I have configured my mocha test command as follows:
mocha --require test/ts-node-hooks.js test/**/*.spec.ts
Additionally, here is my ts-node-hooks.js
file:
const path = require('path');
require("ts-node").register({
project: path.resolve(__dirname, 'tsconfig.json'),
});
Within the /test
directory, my tsconfig.json
file has the javascript target set to ESNEXT
:
{
"compilerOptions": {
/* Basic Options */
"target": "ESNEXT",
"module": "commonjs",
"types": ["@3846masa/axios-cookiejar-support"]
}
}
Despite this configuration, I am encountering the following error:
$ mocha --require test/ts-node-hooks.js test/**/*.spec.ts
/src/Call.ts:41
return (async () => this._callClass = await this.getCallValue('callclass'))();
^
SyntaxError: Unexpected token (
It is worth noting that tsc version 2.6.2
does not encounter any issues when compiling the code.