hbenl / vscode-jasmine-test-adapter

Jasmine Test Adapter for the VS Code Test Explorer
MIT License
20 stars 20 forks source link

show error when Jasmine cannot load tests #45

Closed apla closed 4 years ago

apla commented 4 years ago

Sometimes Jasmine Test Explorer extension cannot load tests. I can see error only with option write diagnostic logs to an output panel. This patch allows error to show as errorNode in Test Explorer treeView.

apla commented 4 years ago

My error usually looks in log like this:

[2020-10-28 20:45:25.914] [INFO] Test Explorer found
[2020-10-28 20:45:25.914] [INFO] Creating adapter for /code/project
[2020-10-28 20:45:25.915] [INFO] Registering adapter for /code/project
[2020-10-28 20:45:25.915] [DEBUG] Using config file: /code/project/test/.jasmine.json
[2020-10-28 20:45:25.916] [INFO] Initialization finished
[2020-10-28 20:45:25.947] [DEBUG] Using specDir: /code/project/test
[2020-10-28 20:45:25.948] [DEBUG] Using test file glob: /code/project/test/*.js
[2020-10-28 20:45:25.948] [DEBUG] Using environment variable config: {}
[2020-10-28 20:45:25.964] [DEBUG] Using nodePath: /usr/local/bin/node
[2020-10-28 20:45:25.964] [DEBUG] Using node arguments: 
[2020-10-28 20:45:25.965] [DEBUG] Using breakOnFirstLine: false
[2020-10-28 20:45:25.965] [INFO] Loading test files of /code/project
[2020-10-28 20:45:26.052] [INFO] Worker: Patching Jasmine
[2020-10-28 20:45:26.053] [INFO] Worker: Loading config file
[2020-10-28 20:45:26.109] [INFO] Worker finished
[2020-10-28 20:45:26.119] [INFO] Worker: Executing Jasmine
[2020-10-28 20:45:26.119] [INFO] Worker: Caught error Error: Cannot find module 'esm'
Require stack:
- /code/vscode-jasmine-test-adapter/node_modules/jasmine/lib/jasmine.js
- /code/vscode-jasmine-test-adapter/out/worker/loadTests.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at /code/vscode-jasmine-test-adapter/node_modules/jasmine/lib/jasmine.js:101:5
    at Array.forEach (<anonymous>)
    at Jasmine.loadRequires (/code/vscode-jasmine-test-adapter/node_modules/jasmine/lib/jasmine.js:100:17)
    at Jasmine.execute (/code/vscode-jasmine-test-adapter/node_modules/jasmine/lib/jasmine.js:238:8)
    at Object.<anonymous> (/code/vscode-jasmine-test-adapter/out/worker/loadTests.js:22:13)
    at Module._compile (internal/modules/cjs/loader.js:1063:30) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/code/vscode-jasmine-test-adapter/node_modules/jasmine/lib/jasmine.js',
    '/code/vscode-jasmine-test-adapter/out/worker/loadTests.js'
  ]
}
hbenl commented 4 years ago

Thanks!