Skip to content

Commit 558cea8

Browse files
committed
Remove VSCode dependency from Mocha test harness.
There is no need for VSCode to be used in order to run the current Mocha tests. The debug adapter doesn't have a dependency on VSCode itself, so the harness is reworked to be a standalone Mocha testing harness. In addition to the changes to the testing harness, code coverage is now also collected. Additional tasks have been added to both run the test harness as well as collect the coverage metrics. Furthermore, coverage metrics are also reported to CodeCov. Shields have also been added to the README covering continuous integration and code coverage. Also the VS Marketplace and Open VSX badges were also added.
1 parent db00740 commit 558cea8

15 files changed

Lines changed: 3018 additions & 471 deletions

.github/workflows/unit_test.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: Unit Test Project
22
on:
33
push:
4+
paths:
5+
- '**.ts'
46
pull_request:
7+
paths:
8+
- '**.ts'
59
jobs:
610
unit_test:
711
runs-on: ubuntu-latest
@@ -17,8 +21,14 @@ jobs:
1721
- name: Install Module Dependencies
1822
run: npm clean-install --no-optional
1923

20-
- name: Compile Project
21-
run: npx tsc --project ./
22-
2324
- name: Test Project
24-
run: xvfb-run --auto-servernum node ./out/src/test/runTest.js
25+
run: npm test
26+
27+
- name: Generate Test Coverage
28+
run: npm run coverage
29+
30+
- name: Report Test Coverage
31+
uses: codecov/codecov-action@v3
32+
with:
33+
directory: ./coverage
34+
verbose: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
out
2+
coverage
23
node_modules
34
*.vsix
5+
.nyc_output
46
.vscode-test

.mocharc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
color: true
2+
recursive: true
3+
require: "ts-node/register"
4+
spec:
5+
- "**/*.test.ts"
6+
ui: "tdd"

.nycrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extends: "@istanbuljs/nyc-config-typescript"
2+
all: true
3+
reporter:
4+
- text
5+
- lcovonly

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"files.exclude": {
55
"out": false // set this to true to hide the "out" folder with the compiled JS files
66
},
7+
"mochaExplorer.timeout": 999999, // Set large so debugging doesn't trigger mocha timeout
78
"search.exclude": {
89
"out": true // set this to false to include "out" folder in search results
910
},
11+
"testExplorer.useNativeTesting": true, // Use VSCode Native Test Explorer
1012
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
1113
}

.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@
4646
"group": "build",
4747
"args": ["run", "lint-and-fix"],
4848
"problemMatcher": "$eslint-compact"
49+
},
50+
// Ctrl + Shift + P (Command Palette), then select "Tasks: Run Test Task" and select "npm:test"
51+
{
52+
"label": "npm:test",
53+
"detail": "Run Project Tests",
54+
"type": "shell",
55+
"command": "npm",
56+
"group": "test",
57+
"args": ["test"]
58+
},
59+
{
60+
"label": "npm:coverage",
61+
"detail": "Run Test Coverage Report",
62+
"type": "shell",
63+
"command": "npm",
64+
"group": "test",
65+
"args": ["run", "coverage"]
4966
}
5067
]
5168
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Debug
22

3+
[![VS Marketplace](https://img.shields.io/visual-studio-marketplace/v/webfreak.debug?label=VS%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=webfreak.debug)
4+
[![Open VSX Registry](https://img.shields.io/open-vsx/v/webfreak/debug?label=Open%20VSX)](https://open-vsx.org/extension/webfreak/debug)
5+
[![GitHub CI Status](https://img.shields.io/github/workflow/status/WebFreak001/code-debug/Unit%20Test%20Project?label=CI&logo=GitHub)](https://github.com/WebFreak001/code-debug/actions/workflows/unit_test.yml)
6+
[![Coverage Status](https://img.shields.io/codecov/c/github/WebFreak001/code-debug)](https://codecov.io/github/WebFreak001/code-debug)
7+
38
Native VSCode debugger. Supports both GDB and LLDB.
49

510
## Installation

0 commit comments

Comments
 (0)