janeriklysander / angular-jest-test-runner

Angular Test Runner for VSCode
0 stars 1 forks source link

Issue with angular-jest-test-runner.debug.ngPath #2

Open mgscuteri opened 1 year ago

mgscuteri commented 1 year ago

I am getting the following error when using the extension to run a test

/bin/bash: ng: command not found

The relative path of my angular/cli ng.js is:

node_modules/@angular/cli/bin/ng.js

I have tried the following workspace settings:

"angular-jest-test-runner.debug.ngPath": "./node_modules/@angular/cli/bin",
"angular-jest-test-runner.debug.ngPath": "./node_modules/@angular/cli/bin/ng",
"angular-jest-test-runner.debug.ngPath": "./node_modules/@angular/cli/bin/ng.js",

I have reloaded vscode in between each settings change. I am on VS Code version:

Version: 1.68.1 (Universal)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:52:13.188Z (6 mos ago)
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.6.0
PhiLhoSoft commented 10 months ago

I have a similar issue, with a different message in a VSC notification: "Could not find ng executable? Please verify that you've provided correct paths in the config and that you have run npm install."

Funnily, the Run Test command works. When I look at the source code, I see the latter just use ng on the path, while Debug tries to use the one in the project. Putting just "ng" in the setting doesn't work either, as the code does a join(cwd, program). Can't use an empty cwd (projectPath) either.

Using the last setting from above, with the .js extension, worked for me. I think this should be in the default of the extension.

In the end, it seems to be a useful extension, working where vscode-jest-runner fails (as it uses pure Jest).

A little weakness is to rely only on the current test name (in it for example), which can be duplicated in the file (under a different describe, for example; eg. same test with a different test set).