Skip to content

Commit d5882e4

Browse files
committed
add tests & CI workflow
1 parent 394a9d2 commit d5882e4

14 files changed

Lines changed: 576 additions & 55 deletions

File tree

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
branches:
10+
- main
11+
- dev
12+
13+
jobs:
14+
compile:
15+
timeout-minutes: 10
16+
runs-on: ubuntu-latest
17+
name: Compile
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set Node.js version to 22
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
28+
- name: Install dependencies
29+
run: npm install
30+
31+
- name: Compile
32+
run: npm run compile
33+
34+
test:
35+
timeout-minutes: 10
36+
runs-on: ubuntu-latest
37+
name: Test
38+
needs: compile
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Set Node.js version to 22
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 22
48+
49+
- name: Install dependencies
50+
run: npm install
51+
52+
- name: Run tests
53+
run: npm test
54+
55+
prettier:
56+
timeout-minutes: 10
57+
runs-on: ubuntu-latest
58+
name: Prettier Check
59+
needs: compile
60+
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Set Node.js version to 22
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: 22
69+
70+
- name: Install dependencies
71+
run: npm install
72+
73+
- name: Run Prettier check
74+
run: npm run prettier-check

.vscode/extensions.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
// See http://go.microsoft.com/fwlink/?LinkId=827846
3-
// for the documentation about the extensions.json format
4-
"recommendations": [
5-
"dbaeumer.vscode-eslint",
6-
"ms-vscode.extension-test-runner"
7-
]
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "ms-vscode.extension-test-runner"]
85
}

.vscode/launch.json

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Run Extension",
10-
"type": "extensionHost",
11-
"request": "launch",
12-
"args": [
13-
"--extensionDevelopmentPath=${workspaceFolder}"
14-
],
15-
"outFiles": [
16-
"${workspaceFolder}/out/**/*.js"
17-
],
18-
"preLaunchTask": "${defaultBuildTask}"
19-
}
20-
]
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
13+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
14+
"preLaunchTask": "${defaultBuildTask}"
15+
}
16+
]
2117
}

.vscode/settings.json

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

.vscode/tasks.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// See https://go.microsoft.com/fwlink/?LinkId=733558
22
// for the documentation about the tasks.json format
33
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"type": "npm",
8-
"script": "watch",
9-
"problemMatcher": "$tsc-watch",
10-
"isBackground": true,
11-
"presentation": {
12-
"reveal": "never"
13-
},
14-
"group": {
15-
"kind": "build",
16-
"isDefault": true
17-
}
18-
}
19-
]
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
2020
}

.vscodeignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
.vscode/**
22
.vscode-test/**
33
src/**
4+
tests/**
45
!src/assets/**
56
.gitignore
6-
.yarnrc
7-
vsc-extension-quickstart.md
87
**/tsconfig.json
98
**/eslint.config.mjs
109
**/*.map

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gitgerbil",
33
"displayName": "GitGerbil",
44
"description": "Scan your project for potential secrets, sensitive information, and less-than-ideal files that you probably shouldn't commit.",
5-
"version": "0.1.3",
5+
"version": "0.1.4",
66
"publisher": "KennethNg",
77
"icon": "./src/assets/icon.png",
88
"repository": {
@@ -22,16 +22,19 @@
2222
"vscode:prepublish": "npm run compile",
2323
"compile": "tsc -p ./",
2424
"watch": "tsc -watch -p ./",
25+
"prettier-check": "prettier . --check",
26+
"unit-test": "mocha ./out/tests/unit",
27+
"integration-test": "node ./out/tests/runTests.js",
2528
"pretest": "npm run compile",
26-
"test": "node ./out/test/runTests.js"
29+
"test": "npm run unit-test && npm run integration-test"
2730
},
2831
"devDependencies": {
2932
"@types/mocha": "^10.0.10",
3033
"@types/node": "25.x",
3134
"@types/vscode": "^1.90.0",
3235
"@vscode/test-electron": "^2.5.2",
3336
"mocha": "^11.7.5",
34-
"tsx": "^4.21.0",
37+
"prettier": "^3.8.1",
3538
"typescript": "^5.8.3"
3639
},
3740
"extensionDependencies": [

0 commit comments

Comments
 (0)