hbenl / vscode-jasmine-test-adapter

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

Help wanted with changing the default Node executable for version 14 (yes, I RTFM) #46

Open ajvincent opened 3 years ago

ajvincent commented 3 years ago

I very recently converted my project to use ES6 modules, and with NodeJS 14 (LTS), everything is fine: npm test running jasmine shows all my tests passing. Alas, I have discovered Visual Studio Code is running NodeJS version 12.14.1 for this extension. ES6 modules started working with Node 13, according to developer.mozilla.org's documentation.

I have been scouring the Visual Studio Code documentation and the main page for this extension. I see that there is a way to specify a different node executable (/usr/bin/node would do nicely). I did see jasmineExplorer.nodePath as the potential option.
But I can't quite put the pieces together to make the adapter use it.

I apologize for abusing the GitHub issues tracker as end-user support, but I've run out of ideas.

Here are files in my project: .vscode/launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "program": "${file}"
    }
  ]
}

spec/support/jasmine.json:

{
  "spec_dir": "spec",
  "spec_files": [
    "**/*[sS]pec.mjs"
  ],
  "helpers": [
    "helpers/**/*.mjs"
  ],
  "stopSpecOnExpectationFailure": false,
  "random": true
}

From the Jasmine Tests output panel:

(node:58292) UnhandledPromiseRejectionWarning: Error: While loading /home/ajvincent/pensum-base/spec/helpers/allElementsInitialized.mjs: Error: Not supported
    at /home/ajvincent/.vscode/extensions/hbenl.vscode-jasmine-test-adapter-1.7.1/node_modules/jasmine/lib/loader.js:22:30
    at async Jasmine.loadHelpers (/home/ajvincent/.vscode/extensions/hbenl.vscode-jasmine-test-adapter-1.7.1/node_modules/jasmine/lib/jasmine.js:97:5)
    at async Jasmine.execute (/home/ajvincent/.vscode/extensions/hbenl.vscode-jasmine-test-adapter-1.7.1/node_modules/jasmine/lib/jasmine.js:247:3)
(node:58292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:58292) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It was loader.js above that I patched with console.log(Version: ${process.version}); to determine the version of NodeJS.