vscode-jest
vscode-jest copied to clipboard
fails to debug Typescript code
I am trying to use the debugger. Here's what the output looks like when I hit debug on a testcase:
FAIL services/servicenameA/handler.test.js
● Test suite failed to run
SyntaxError: C:\Users\SIKAU\FILEPATH\filename.ts: Unexpected token, expected "," (9:58)
7 |
8 | //const dynamoDb = new AWS.DynamoDB.DocumentClient();
> 9 | export async function getAccountIdImplementation(accountId: string) {
| ^
at Parser._raise (node_modules/@babel/parser/src/parser/error.js:97:45)
at Parser.raiseWithData (node_modules/@babel/parser/src/parser/error.js:92:17)
at Parser.raise (node_modules/@babel/parser/src/parser/error.js:41:17)
at Parser.unexpected (node_modules/@babel/parser/src/parser/util.js:140:16)
at Parser.expect (node_modules/@babel/parser/src/parser/util.js:117:28)
at Parser.parseBindingList (node_modules/@babel/parser/src/parser/lval.js:315:14)
at Parser.parseFunctionParams (node_modules/@babel/parser/src/parser/statement.js:1121:24)
at Parser.parseFunction (node_modules/@babel/parser/src/parser/statement.js:1087:10)
at Parser.parseFunctionStatement (node_modules/@babel/parser/src/parser/statement.js:553:17)
at Parser.parseStatementContent (node_modules/@babel/parser/src/parser/statement.js:283:23)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 7.788 s
My jest.config.js looks like follows:
// jest.config.js
module.exports = {
collectCoverageFrom: ['./services/**/*.{js, ts,tsx}'],
coverageThreshold: {
'./services/**/*.js': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
'./services/**/*.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleDirectories: [
'node_modules',
],
}
tsconfig.json looks like:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"moduleResolution": "node",
"sourceMap": true,
"target": "ES6"
},
"exclude": ["node_modules", "**/*.spec.ts"],
"composite": true,
"declarationMap": true,
"strict": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"strictNullChecks": true,
"noImplicitReturns": true,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"esModuleInterop": true
}
babel.config.js
module.exports = {presets: ['@babel/preset-env']}
The Debugger fails while testing Typescript code.
How do I get this going? Have tried googling and whatnot. Nothing has fixed the issue and the debugger just won't run.
Similar problem for me -
expect(el.shadowRoot!.querySelector('button').... tests refuse to run because of the ! operator after shadowRoot