-
Notifications
You must be signed in to change notification settings - Fork 29k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run tests under different directory with CLI #17993
Comments
As far as I understand you are trying to run your tests via the vscode integrated terminal -> thus forwarding to @Tyriar |
@wopian when running the tests using the debugger, VS Code shows the exact command that it runs on the debug console. Did you try to run this command from the CLI? |
The command it shows is: 'C:\Program Files (x86)\Microsoft VS Code\Code.exe' --debugBrkPluginHost=11634 --extensionDevelopmentPath=c:\github\agc-assembly --extensionTestsPath=c:\github\agc-assembly/lib/test Running that in a CLI (PowerShell, MINGW64 or VSC's Integrated Terminal) on Windows gives: The filename, directory name, or volume label syntax is incorrect. And of course would require 3 different scripts for tests to be run on Windows, Mac and Linux (CI)
"test": "node ./node_modules/vscode/bin/test --silent" |
Inspecting the var testsFolder;
if (process.env.CODE_TESTS_PATH) {
testsFolder = process.env.CODE_TESTS_PATH;
} else if (fs.existsSync(path.join(process.cwd(), 'out', 'test'))) {
testsFolder = path.join(process.cwd(), 'out', 'test'); // TS extension
} else {
testsFolder = path.join(process.cwd(), 'test'); // JS extension
} Changing it use var testsFolder;
if (process.env.CODE_TESTS_PATH) {
testsFolder = process.env.CODE_TESTS_PATH;
} else if (fs.existsSync(path.join(process.cwd(), 'lib', 'test'))) {
testsFolder = path.join(process.cwd(), 'lib', 'test'); // TS extension
} else {
testsFolder = path.join(process.cwd(), 'test'); // JS extension
} Using the |
Anyone ever figure out how to work around this? As @wopian pointed out CODE_TESTS_PATH needs the absolute path which is obviously going to be different on every system. |
Launching tests within VS Code using the debugger, my tests are run under
./lib/test
as defined in thelaunch.json
config file. (Example)However running tests from CLI, I can't seem to pass the correct tests path.
npm test
ornode ./node_modules/vscode/bin/test
both attempt and fail to run tests underreponame/test
by default. Tried passing--extensionTestsPath=./lib/test
to either of these to no avail.Terminal Output:
The text was updated successfully, but these errors were encountered: