vscode-test-explorer icon indicating copy to clipboard operation
vscode-test-explorer copied to clipboard

[Question] Is it possible to specify package.json location?

Open Krossmaskinen opened this issue 4 years ago • 5 comments

My package.json is in a sub folder of the currently open folder in VS Code. When Test Explorer tries to load the tests it only looks in the root level of the current folder so it doesn't find the package.json.

Is there a way to specify what package.json it should look at?

Krossmaskinen avatar May 08 '20 06:05 Krossmaskinen

I'm not the author, but i think it would be helpful if you would explain what is the situation. This description is just doesn't add up. How the package.json comes into the picture? Are you using Mocha or some javascript test explorer? If yes I would suggest to put your request there. This extension is about the UI, the backbone of those extensions. (And close this issue here^^)

matepek avatar May 14 '20 02:05 matepek

This is the root folder I'm opening in VSCode: /home/bill/projects/my-project

This is the error message I get from the test explorer sidebar: [Error: ENOENT: no such file or directory, open '/home/bill/projects/my-project/package.json'] { errno: [33m-2[39m, code: [32m'ENOENT'[39m, syscall: [32m'open'[39m, path: [32m'/home/bill/projects/my-project/package.json'[39m }

My package.json that I want to use is in this path: /home/bill/projects/my-project/app/package.json

It seems like the extension runs the npm test from package.json in the root folder.

Krossmaskinen avatar May 14 '20 08:05 Krossmaskinen

But you might be right. Might be the another one of the extensions that has the problem.

Krossmaskinen avatar May 14 '20 08:05 Krossmaskinen

You might find that you're using my extension. If so you might be interested in this issue kavod-io/vscode-jest-test-adapter#56. There is a workaround by using workspace folders. But your comment about being able to specify the location of the package.json is valid.

rossknudsen avatar May 15 '20 01:05 rossknudsen

Just to be clear: There is no package.json in the context of Test Explorer (this extension). (Except that the extension itself is a vscode extension so it has to have package.json but no one should care about that because that is the inner business of vscode and this extension.)

Right? (If yes, close this pls and the author can concentrate on my issues 😄)

matepek avatar May 15 '20 02:05 matepek