-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧪 Redesign testing to use vscode-test CLI (#235)
VSCode-required E2E tests and Mocha tests are run separately now based on whether they are in a thing.tests.ts or thing.vscode.tests.ts file.
- Loading branch information
1 parent
707d6a0
commit d73c910
Showing
19 changed files
with
177 additions
and
858 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require: 'esbuild-register' | ||
spec: | ||
- 'src/**/*.test.ts' | ||
- 'test/**/*.test.ts' | ||
ignore: ['**/*.vscode.test.ts'] | ||
exit: true | ||
failZero: true | ||
color: true | ||
enable-source-maps: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Dont forget to update this in package.json script esbuild-base too! | ||
use-node-version=18.15.0 | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// .vscode-test.js | ||
const { defineConfig } = require('@vscode/test-cli') | ||
|
||
module.exports = defineConfig({ | ||
files: 'dist/test/**/*.vscode.test.js', | ||
launchArgs: ['--profile=vscode-pester-test'], | ||
mocha: { | ||
ui: 'bdd', | ||
timeout: 600000 // 10 minutes to allow for debugging | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,26 +86,24 @@ | |
], | ||
"main": "./dist/extension.js", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-swc": "^0.3.0", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@swc-node/register": "^1.6.8", | ||
"@types/chai": "^4.3.5", | ||
"@types/debounce-promise": "^3.1.9", | ||
"@types/glob": "^8.1.0", | ||
"@types/json-parse-safe": "^2.0.3", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.10.6", | ||
"@types/readline-transform": "^1.0.4", | ||
"@types/vscode": "^1.77.0", | ||
"@typescript-eslint/eslint-plugin": "^6.16.0", | ||
"@typescript-eslint/parser": "^6.16.0", | ||
"@vscode/dts": "^0.4.0", | ||
"@vscode/test-cli": "^0.0.4", | ||
"@vscode/test-electron": "^2.3.8", | ||
"@vscode/vsce": "^2.22.0", | ||
"chai": "^5.0.0", | ||
"debounce-promise": "^3.1.2", | ||
"esbuild": "^0.19.11", | ||
"esbuild-register": "^3.5.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-config-standard-with-typescript": "^43.0.0", | ||
|
@@ -116,13 +114,11 @@ | |
"json-parse-safe": "^2.0.0", | ||
"lookpath": "^1.2.2", | ||
"mocha": "^10.2.0", | ||
"mocha-multi-reporters": "^1.5.1", | ||
"path": "^0.12.7", | ||
"pkgroll": "^2.0.1", | ||
"prettier": "^3.1.1", | ||
"prettier-eslint": "^16.2.0", | ||
"readline-transform": "^1.0.0", | ||
"rollup": "^4.9.2", | ||
"sinon": "^17.0.1", | ||
"tslog": "^4.9.2", | ||
"typescript": "^5.3.3", | ||
|
@@ -145,25 +141,32 @@ | |
} | ||
], | ||
"scripts": { | ||
"esbuild-base": "pnpm esbuild --minify --bundle --platform=node --target=node18.15 --format=cjs --sourcemap --sources-content=false --external:mocha --external:vscode", | ||
"package": "vsce package --no-update-package-json --no-git-tag-version --no-dependencies", | ||
"publish": "pnpm run publishStable --pre-release --no-git-tag-version", | ||
"publishStable": "vsce publish --no-update-package-json --no-dependencies", | ||
"build": "rollup --config", | ||
"build": "pnpm run esbuild-base src/extension.ts --outdir=dist", | ||
"build-watch": "pnpm run build --watch", | ||
"build-test-vscode": "pnpm run esbuild-base src/**/*.vscode.test.ts test/**/*.vscode.test.ts --outdir=dist/test", | ||
"build-test-vscode-watch": "pnpm run build-test-vscode --watch", | ||
"test-mocha": "mocha", | ||
"test-mocha-vscode": "pnpm vscode-test", | ||
"test": "pnpm test-mocha && pnpm test-mocha-vscode", | ||
"test-watch": "pnpm test-mocha --watch", | ||
"lint-eslint": "eslint . --ext .ts", | ||
"lint-prettier": "prettier --check .", | ||
"lint-tsc": "tsc --noemit", | ||
"lint": "pnpm lint-eslint || pnpm lint-prettier || pnpm lint-tsc", | ||
"test-mocha": "mocha", | ||
"test-mocha-vscode": "node -r @swc-node/register test/runTests.ts", | ||
"test": "pnpm test-mocha && pnpm test-mocha-vscode", | ||
"test-watch": "pnpm test-mocha --watch", | ||
"download-api": "vscode-dts main", | ||
"postdownload-api": "vscode-dts main", | ||
"vscode:prepublish": "pnpm run build" | ||
}, | ||
"dependencies": { | ||
"@ctiterm/strip-ansi": "^1.0.0", | ||
"@swc/core": "^1.3.102" | ||
"@ctiterm/strip-ansi": "^1.0.0" | ||
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"@vscode/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/out/bin.mjs b/out/bin.mjs | ||
index 5282c55bd62d0b77c17f77a173ff848286c0c2f8..857e6d9ca1b6275185c11ab7ebadb1646b5a5afe 100644 | ||
--- a/out/bin.mjs | ||
+++ b/out/bin.mjs | ||
@@ -11,6 +11,9 @@ import { dirname, isAbsolute, join, resolve } from 'path'; | ||
import supportsColor from 'supports-color'; | ||
import { fileURLToPath, pathToFileURL } from 'url'; | ||
import yargs from 'yargs'; | ||
+import { createRequire } from 'node:module'; | ||
+ | ||
+const require = createRequire(import.meta.url); | ||
const rulesAndBehavior = 'Mocha: Rules & Behavior'; | ||
const reportingAndOutput = 'Mocha: Reporting & Output'; | ||
const fileHandling = 'Mocha: File Handling'; |
Oops, something went wrong.