Skip to content

Commit d106e4c

Browse files
Ensure that integration tests execute the same code as the extension (#1131)
1 parent ae6ecd5 commit d106e4c

8 files changed

+17
-22
lines changed

.vscode-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = defineConfig({
2727
tests: [
2828
{
2929
label: "integrationTests",
30-
files: ["out/test/common.js", "out/test/integration-tests/**/*.test.js"],
30+
files: ["dist/test/common.js", "dist/test/integration-tests/**/*.test.js"],
3131
version: process.env["VSCODE_VERSION"] ?? "stable",
3232
workspaceFolder: "./assets/test",
3333
launchArgs: [
@@ -49,7 +49,7 @@ module.exports = defineConfig({
4949
},
5050
{
5151
label: "unitTests",
52-
files: ["out/test/common.js", "out/test/unit-tests/**/*.test.js"],
52+
files: ["dist/test/common.js", "dist/test/unit-tests/**/*.test.js"],
5353
version: process.env["VSCODE_VERSION"] ?? "stable",
5454
launchArgs: [
5555
"--disable-extensions",

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
44
"recommendations": [
5-
"connor4312.esbuild-problem-matchers",
65
"dbaeumer.vscode-eslint",
76
"esbenp.prettier-vscode"
87
]

.vscode/launch.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"--profile=testing-debug"
3131
],
3232
"outFiles": [
33-
"${workspaceFolder}/out/**/*.js",
3433
"${workspaceFolder}/dist/**/*.js"
3534
],
3635
"env": {
@@ -45,7 +44,7 @@
4544
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
4645
"testConfigurationLabel": "unitTests",
4746
"outFiles": [
48-
"${workspaceFolder}/out/**/*.js"
47+
"${workspaceFolder}/dist/**/*.js"
4948
],
5049
"preLaunchTask": "compile-tests"
5150
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
33
"files.exclude": {
4-
"out": false // set this to true to hide the "out" folder with the compiled JS files
4+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
55
},
66
"search.exclude": {
7-
"out": true // set this to false to include "out" folder in search results
7+
"dist": true // set this to false to include "dist" folder in search results
88
},
99
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
1010
"typescript.tsc.autoDetect": "off",

.vscode/tasks.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
{
77
"label": "build",
88
"type": "npm",
9-
"script": "esbuild-watch",
10-
"problemMatcher": "$esbuild-watch",
11-
"isBackground": true,
9+
"script": "watch",
10+
"problemMatcher": "$tsc-watch",
1211
"presentation": {
1312
"reveal": "never"
1413
},
14+
"isBackground": true,
1515
"group": {
1616
"kind": "build",
1717
"isDefault": true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ nvm install
2828
npm install
2929
```
3030

31-
When you first open the project in VS Code you will be recommended to also install [`ESLint`](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint), [`Prettier - Code formatter`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and [`esbuild Problem Matchers`](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers). Please do so. `ESLint`, `Prettier - Code formatter` is used to ensure a consistent style and we expect everyone who contributes to follow this style as well. `esbuild Problem Matchers` provides proper error output from building the project.
31+
When you first open the project in VS Code you will be recommended to also install [`ESLint`](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [`Prettier - Code formatter`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). Please do so. `ESLint`, `Prettier - Code formatter` is used to ensure a consistent style and we expect everyone who contributes to follow this style as well.
3232

3333
To run your version of the Swift extension while in VS Code, press `F5`. This will open up another instance of VS Code with it running. You can use the original version of VS Code to debug it.
3434

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"workspaceContains:compile_commands.json",
2929
"onDebugResolve:swift-lldb"
3030
],
31-
"main": "./dist/extension.js",
31+
"main": "./dist/src/extension.js",
3232
"contributes": {
3333
"icons": {
3434
"swift-icon": {
@@ -1266,13 +1266,10 @@
12661266
"vadimcn.vscode-lldb"
12671267
],
12681268
"scripts": {
1269-
"vscode:prepublish": "npm run esbuild-bundle",
1270-
"esbuild-base": "del-cli ./dist && esbuild \"./src/**/*.ts\" --outdir=dist --format=cjs --platform=node --target=node18",
1271-
"esbuild": "npm run esbuild-base",
1272-
"esbuild-watch": "npm run esbuild-base -- --watch",
1273-
"esbuild-bundle": "del-cli ./dist && esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --target=node18 --minify --sourcemap",
1274-
"compile": "tsc",
1275-
"watch": "tsc --watch",
1269+
"vscode:prepublish": "npm run bundle",
1270+
"bundle": "del-cli ./dist && esbuild ./src/extension.ts --bundle --outfile=dist/src/extension.js --external:vscode --format=cjs --platform=node --target=node18 --minify --sourcemap",
1271+
"compile": "del-cli ./dist && tsc",
1272+
"watch": "del-cli ./dist && tsc --watch",
12761273
"lint": "eslint ./ --ext ts && tsc --noEmit",
12771274
"format": "prettier --check .",
12781275
"pretest": "npm run compile-tests",
@@ -1283,7 +1280,7 @@
12831280
"integration-test": "npm test -- --label integrationTests",
12841281
"unit-test": "npm test -- --label unitTests",
12851282
"coverage": "npm test -- --coverage",
1286-
"compile-tests": "del-cli ./assets/test/**/.build && npm run compile && npm run esbuild",
1283+
"compile-tests": "del-cli ./assets/test/**/.build && npm run compile",
12871284
"package": "vsce package",
12881285
"dev-package": "vsce package --no-update-package-json 1.12.0-dev",
12891286
"preview-package": "vsce package --pre-release",

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"module": "commonjs",
44
"target": "ES2020",
5-
"outDir": "out",
5+
"outDir": "dist",
66
"lib": ["ES2020"],
77
"sourceMap": true,
88
"strict": true /* enable all strict type-checking options */
@@ -11,5 +11,5 @@
1111
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
1212
// "noUnusedParameters": true, /* Report errors on unused parameters. */
1313
},
14-
"exclude": ["node_modules", ".vscode-test"]
14+
"include": ["src/**/*.ts", "test/**/*.ts"]
1515
}

0 commit comments

Comments
 (0)