Trying to load/run tests from VScode with Mocha Test Explorer, but it fails with a mocha error while loading my tests.
I added this to settings.json
"mochaExplorer.mochaPath": "/Users/daviddeasy/.nvm/versions/node/v18.11.0/bin/mocha",
"mochaExplorer.files": "test/unit/test/*.js",
and Test Explorer can see the test file ok, but then the mocha worker fails.
[2023-12-06 17:49:59.171] [INFO] Loading test files of /Users/daviddeasy/dev/velox/apim
[2023-12-06 17:49:59.172] [DEBUG] Using working directory: /Users/daviddeasy/dev/velox/apim
[2023-12-06 17:49:59.195] [DEBUG] Using nodePath: /Users/daviddeasy/.nvm/versions/node/v18.11.0/bin/node
[2023-12-06 17:49:59.302] [DEBUG] Using Mocha options: {"ui":"bdd","timeout":2000,"retries":0,"requires":[],"delay":false,"fullTrace":false,"exit":false,"asyncOnly":false,"parallel":false}
[2023-12-06 17:49:59.303] [DEBUG] Looking for test files ["test/unit/test/*.js"] in /Users/daviddeasy/dev/velox/apim
[2023-12-06 17:49:59.303] [DEBUG] Found test files ["/Users/daviddeasy/dev/velox/apim/test/unit/test/analyticsPushTests.js","/Users/daviddeasy/dev/velox/apim/test/unit/test/endpointTests.js","/Users/daviddeasy/dev/velox/apim/test/unit/test/propertySubstitution.js","/Users/daviddeasy/dev/velox/apim/test/unit/test/testFinalTaskCleanup.js"]
[2023-12-06 17:49:59.303] [DEBUG] Using environment variables from config: {}
[2023-12-06 17:49:59.304] [DEBUG] Spawning /Users/daviddeasy/.vscode/extensions/hbenl.vscode-mocha-test-adapter-2.14.1/out/worker/bundle.js with IPC options {}
[2023-12-06 17:49:59.341] [INFO] Worker: Using the mocha package at /Users/daviddeasy/.nvm/versions/node/v18.11.0/bin/mocha
[2023-12-06 17:49:59.410] [ERROR] Worker (stderr): [31mError: No test files found: "{}"[39m
[2023-12-06 17:49:59.418] [INFO] Worker finished with code 1 and signal null
I expected Test Explorer to provide the test info to mocha but maybe I need to configure the same test info for both Test Explorer and mocha?
I can run tests find from command line, e.g.
mocha mocha test/unit/test
Working ok after removing the 2 'mochaExplorer' lines I added to settings.json and putting the creating a
.mocharc.json
file with the test files specI think the problem was probably the
mochaExplorer.mochaPath
entry that I added to settings.json to try to get around an earlier problem.