Skip to content
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

Enable Mocha Test Explorer Integration #4518

Merged
merged 12 commits into from
Apr 14, 2023
Merged
11 changes: 11 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"color": true,
"enable-source-maps": true,
"extensions": [
".js",
".jsx"
],
"require": "source-map-support/register",
"timeout": 10000,
"spec": "out/test/**/*.test.js"
}
127 changes: 127 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"version": "0.2.0",
"configurations": [
// NOTE: These are not in the code-workspace file because StartDebugging cannot current resolve configs stored there so they have to be here for the Mocha Test Explorer feature.
// Ref: https://github.com/microsoft/vscode/issues/150663
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"__TEST_WORKSPACE_PATH": "${workspaceFolder}/examples",
},
"sourceMaps": true,
// This speeds up source map detection and makes smartStep work correctly
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"!**/node_modules/**",
"!**/.vscode-test/**"
],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/.vscode-test/**"
],
"presentation": {
"hidden": false,
"group": "test",
"order": 2
}
},
{
// Runs the extension in an empty temp profile that is automatically cleaned up after use
// Undocumented: https://github.com/microsoft/vscode-docs/issues/6220
"name": "Launch Extension - Temp Profile",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--profile-temp",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/examples"
],
"sourceMaps": true,
// This speeds up source map detection and makes smartStep work correctly
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"!**/node_modules/**",
"!**/.vscode-test/**"
],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/.vscode-test/**"
],
"presentation": {
"hidden": false,
"group": "test",
"order": 2
}
},
{
// Runs the extension in an isolated but persistent profile separate from the user settings
// Undocumented: https://github.com/microsoft/vscode-docs/issues/6220
"name": "Launch Extension - Isolated Profile",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--profile=debug",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/examples"
],
"sourceMaps": true,
// This speeds up source map detection and makes smartStep work correctly
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"!**/node_modules/**",
"!**/.vscode-test/**"
],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/.vscode-test/**"
],
"presentation": {
"hidden": false,
"group": "test",
"order": 2
}
},
{
"name": "Test Extension",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/out/test/runTests.js",
"cascadeTerminateToConfigurations": [
"ExtensionTests",
],
// This speeds up source map detection and makes smartStep work correctly
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"!**/node_modules/**",
"!**/.vscode-test/**"
],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/.vscode-test/**"
],
"attachSimplePort": 59229, // THe default is 9229 but we want to avoid conflicts because we will have two vscode instances running.
"env": {
"__TEST_DEBUG_INSPECT_PORT": "59229" // Needs to match attachSimplePort
},
"presentation": {
"hidden": false,
},
"internalConsoleOptions": "neverOpen",
"console": "integratedTerminal",
"autoAttachChildProcesses": false,
"preLaunchTask": "test-watch"
}
]
}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "test-watch",
"icon": {
"color": "terminal.ansiCyan",
"id": "sync"
},
"type": "npm",
"script": "build-test-watch",
"group": "test",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"dependsOn": "build-watch" // We need to also build main.js extension for testing or it leads to sourcemap errors
},
{
"label": "build-watch",
"icon": {
"color": "terminal.ansiCyan",
"id": "sync"
},
"type": "npm",
"script": "build-watch",
"group": "build",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
}
]
}
Loading