Node Visual Studio Mocha test tools do not detect Mocha module

I have a node project that I imported into Visual Studio from Web Storm. The mocha tests work fine in Web Storm, but they don't run at all in Visual Studio. I set the test structure for the corresponding files, and the test detection phase correctly finds them. When I run the tests, they get a green checkmark, even if I change the system so that they fail. If I click on the exit for the test, I see an error:

NTVS_ERROR: Could not find Mocha package. Mocha should be installed locally in the project ...

I installed Mocha locally, uninstalled and installed again, but no difference.

I was able to get more detailed error information by editing the mocha.js file to print what was going wrong. The problem occurs during the detectMocha function. The exception that I get in the log is the following:

[Error: cannot find module 'C: \ projects \ FastLaneVS "\ node_modules \ mocha'] code: 'MODULE_NOT_FOUND'

Now I believe that this extra double quote after my project directory is a problem. I went back to run_tests.js and printed out the argv array to find out where the project directory was coming from and if it had really been added at the time this function was called.

Now I am glad to accept that I did something and added this quote somewhere, but I can not find it. I also don't understand why find_tests should work, since it calls the same method and passes the project directory correctly.

In my project, the directory is listed as. and I checked the sln and nsproj files in notepad ++ to try and find a false double quote.

I am using VS pro 2013 update 4 using node tools 1.0.21029.05

I could change the mocha runner to crop a double quote, but any ideas on how I can fix this correctly would be great.

+6
source share

Source: https://habr.com/ru/post/978397/


All Articles