Skip to content

Commit

Permalink
test: Introduces Vitest for unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler@tailscale.com>
  • Loading branch information
tylersmalley committed Jul 20, 2023
1 parent 5310782 commit b418cd8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
key: yarn-cache
- name: Install dependencies
run: tool/yarn install --frozen-lockfile --prefer-offline
- name: Unit tests
run: tool/yarn test
- name: Lint
run: tool/yarn lint
- name: Typescript
Expand Down
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"smartStep": true,
"console": "integratedTerminal"
}
]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
"package": "vsce package --allow-star-activation",
"precommit": "lint-staged",
"prepare": "husky install",
"test": "vitest",
"vscode:prepublish": "(yarn run bundle-js & pid1=$!; yarn run bundle-go & pid2=$!; wait $pid1 || exit 1; wait $pid2 || exit 1)",
"watch": "webpack serve"
},
Expand Down Expand Up @@ -351,6 +352,7 @@
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"utf-8-validate": "^6.0.3",
"vitest": "^.33.0",
"vscode-jsonrpc": "^8.1.0",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
Expand Down
7 changes: 7 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
test: {
exclude: [...configDefaults.exclude, '**/out/**'],
},
});

0 comments on commit b418cd8

Please sign in to comment.