Jest extension compatibility:
Debug launcher
Correct command jest execution
Fix jest test regex + add flag
MODIFY
.vscode/launch.json
.vscode/launch.json
"version": "0.2.0",
"configurations": [
{
- "name": "Debug Mocha Tests",
- "type": "pwa-node",
- "request": "attach",
- "port": 9230,
- "timeout": 30000,
- "skipFiles": [
- "<node_internals>/**"
+ "type": "node",
+ "name": "vscode-jest-tests",
+ "request": "launch",
+ "program": "${workspaceFolder}/node_modules/.bin/jest",
+ "args": [
+ "--i",
+ "--runInBand",
+ "--watchAll=false",
],
+ "cwd": "${workspaceFolder}",
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen",
+ "disableOptimisticBPs": false,
+ "windows": {
+ "program": "${workspaceFolder}/node_modules/jest/bin/jest"
+ }
},
{
"name": "Debug ev-server",
"stopOnEntry": true
},
{
- "name": "Debug mochatest:createContext",
+ "name": "Debug test:createContext",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
- "mochatest:createContext"
+ "test:createContext"
],
"sourceMaps": true,
"resolveSourceMapLocations": [

MODIFY
jest.config.ts
jest.config.ts
@@ -147,7 +147,7 @@ export default {
// The glob patterns Jest uses to detect test files
testMatch: [
- "**/test/**/*(Runner|Test)*.ts"
+ "**/test/**/*Test.ts","**/test/**/*Runner.ts"
],
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",

MODIFY
package.json
package.json
"xmake:download-node-headers": "wget https://nexus.wdf.sap.corp:8443/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/org/nodejs/download/node/node-headers/14.15.4/node-headers-14.15.4.tar.gz -P ${WORKSPACE}/gen/tmp/",
"xmake:download-libvibs-headers": "wget https://nexus.wdf.sap.corp:8443/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/lovell/sharp/libvips/8.10.6/libvips-8.10.6-linux-x64.tar.br -P ${WORKSPACE}/gen/tmp/libvips/v8.10.6/",
- "test": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit test/**/*Test.ts",
- "test:createContext": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit ContextBuilderRunner.ts",
- "test:asset": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/AssetTest.ts",
- "test:authentication": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/AuthenticationTest.ts",
- "test:billing": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/BillingTest.ts",
- "test:car": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/CarTest.ts",
- "test:company": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/Company*Test.ts",
- "test:componentActivation": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/ComponentActivation*Test.ts",
- "test:crypto": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/EncryptionSettingTest.ts",
- "test:filter": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/FilterTest.ts",
- "test:firmwareUpdateStatus": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/FirmwareUpdateStatusTest.ts",
- "test:locking": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/LockingTest.ts",
- "test:ocpi": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/OCPIServerTest.ts",
- "test:ocpp": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/OCPP*Test.ts",
- "test:oicp": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/OICP*Test.ts",
- "test:registrationToken": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/RegistrationTokenTest.ts",
- "test:security": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/SecurityTest.ts",
- "test:setting": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/*SettingTest.ts",
- "test:site": "npm version && cross-env TS_NODE_FILES=true jest --runInBand test/**/Site*Test.ts",
- "test:smartCharging": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/SmartChargingTest.ts",
- "test:stat": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/StatisticsTest.ts",
- "test:tag": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/TagTest.ts",
- "test:tenant": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/*TenantTest.ts",
- "test:transaction": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --forceExit -- test/**/TransactionTest.ts",
- "test:template": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/UnitTestTemplate.ts",
- "test:user": "npm version && cross-env TS_NODE_FILES=true jest --runInBand -- test/**/UserTest.ts"
+ "test": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit --testPathIgnorePatterns='.*Runner.ts$'",
+ "test:createContext": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- ContextBuilderRunner.ts",
+ "test:asset": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/AssetTest.ts",
+ "test:authentication": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/AuthenticationTest.ts",
+ "test:billing": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/BillingTest.ts",
+ "test:car": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/CarTest.ts",
+ "test:company": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/Company*Test.ts",
+ "test:componentActivation": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/ComponentActivation*Test.ts",
+ "test:crypto": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/EncryptionSettingTest.ts",
+ "test:filter": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/FilterTest.ts",
+ "test:firmwareUpdateStatus": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/FirmwareUpdateStatusTest.ts",
+ "test:locking": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/LockingTest.ts",
+ "test:ocpi": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/OCPIServerTest.ts",
+ "test:ocpp": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/OCPP*Test.ts",
+ "test:oicp": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/OICP*Test.ts",
+ "test:registrationToken": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/RegistrationTokenTest.ts",
+ "test:security": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/SecurityTest.ts",
+ "test:setting": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/*SettingTest.ts",
+ "test:site": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage test/**/Site*Test.ts",
+ "test:smartCharging": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/SmartChargingTest.ts",
+ "test:stat": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/StatisticsTest.ts",
+ "test:tag": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/TagTest.ts",
+ "test:tenant": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/*TenantTest.ts",
+ "test:transaction": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage --forceExit -- test/**/TransactionTest.ts",
+ "test:template": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/UnitTestTemplate.ts",
+ "test:user": "npm version && cross-env TS_NODE_FILES=true jest --runInBand --logHeapUsage -- test/**/UserTest.ts"
},
"dependencies": {
"ajv": "^8.6.3",

Jest extension compatibility:
- Debug launcher
- Correct command jest execution
- Fix jest test regex + add flag