Skip to content

Ensure that integration tests execute the same code as the extension #1131

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

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = defineConfig({
tests: [
{
label: "integrationTests",
files: ["out/test/common.js", "out/test/integration-tests/**/*.test.js"],
files: ["dist/test/common.js", "dist/test/integration-tests/**/*.test.js"],
version: process.env["VSCODE_VERSION"] ?? "stable",
workspaceFolder: "./assets/test",
launchArgs: [
Expand All @@ -50,7 +50,7 @@ module.exports = defineConfig({
},
{
label: "unitTests",
files: ["out/test/common.js", "out/test/unit-tests/**/*.test.js"],
files: ["dist/test/common.js", "dist/test/unit-tests/**/*.test.js"],
version: process.env["VSCODE_VERSION"] ?? "stable",
launchArgs: [
"--disable-extensions",
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"connor4312.esbuild-problem-matchers",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
Expand Down
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"--profile=testing-debug"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"env": {
Expand All @@ -45,7 +44,7 @@
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
"testConfigurationLabel": "unitTests",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "compile-tests"
}
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
Expand Down
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
{
"label": "build",
"type": "npm",
"script": "esbuild-watch",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"script": "watch",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "never"
},
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ nvm install
npm install
```

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.
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.

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.

Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"workspaceContains:compile_commands.json",
"onDebugResolve:swift-lldb"
],
"main": "./dist/extension.js",
"main": "./dist/src/extension.js",
"contributes": {
"icons": {
"swift-icon": {
Expand Down Expand Up @@ -1266,13 +1266,10 @@
"vadimcn.vscode-lldb"
],
"scripts": {
"vscode:prepublish": "npm run esbuild-bundle",
"esbuild-base": "del-cli ./dist && esbuild \"./src/**/*.ts\" --outdir=dist --format=cjs --platform=node --target=node18",
"esbuild": "npm run esbuild-base",
"esbuild-watch": "npm run esbuild-base -- --watch",
"esbuild-bundle": "del-cli ./dist && esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --target=node18 --minify --sourcemap",
"compile": "tsc",
"watch": "tsc --watch",
"vscode:prepublish": "npm run bundle",
"bundle": "del-cli ./dist && esbuild ./src/extension.ts --bundle --outfile=dist/src/extension.js --external:vscode --format=cjs --platform=node --target=node18 --minify --sourcemap",
"compile": "del-cli ./dist && tsc",
"watch": "del-cli ./dist && tsc --watch",
"lint": "eslint ./ --ext ts && tsc --noEmit",
"format": "prettier --check *.json src test",
"pretest": "npm run compile-tests",
Expand All @@ -1283,7 +1280,7 @@
"integration-test": "npm test -- --label integrationTests",
"unit-test": "npm test -- --label unitTests",
"coverage": "npm test -- --coverage",
"compile-tests": "del-cli ./assets/test/**/.build && npm run compile && npm run esbuild",
"compile-tests": "del-cli ./assets/test/**/.build && npm run compile",
"package": "vsce package",
"dev-package": "vsce package --no-update-package-json 1.12.0-dev",
"preview-package": "vsce package --pre-release",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"outDir": "dist",
"lib": ["ES2020"],
"sourceMap": true,
"strict": true /* enable all strict type-checking options */
Expand All @@ -11,5 +11,5 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": ["node_modules", ".vscode-test"]
"include": ["src/**/*.ts", "test/**/*.ts"]
}