Skip to content

Commit b9fc980

Browse files
DagdonChrisChinchillaCopilot
authored
created test files and other files added some config to package.json (#49)
* created test files and other files added some config to package json * Get tests to run and refactor to also run in CI * Update test/suites/index.js Co-authored-by: Copilot <[email protected]> * fixed unused vars declaration * Fix lack of copied output * Add todo action --------- Co-authored-by: Chris Chinchilla <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 50b33d4 commit b9fc980

File tree

14 files changed

+2110
-400
lines changed

14 files changed

+2110
-400
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ jobs:
2222
run: npm ci
2323
- name: npm-compile
2424
run: npm run compile
25+
- name: Run tests
26+
run: xvfb-run -a npm run test:headless
2527
- name: vsce package
2628
run: vsce package

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
node-version: [18, 20, 22]
16+
fail-fast: false
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Compile TypeScript
34+
run: npm run compile
35+
36+
- name: Run tests (Linux)
37+
if: runner.os == 'Linux'
38+
run: xvfb-run -a npm run test:headless
39+
env:
40+
CI: true
41+
42+
- name: Run tests (Windows/macOS)
43+
if: runner.os != 'Linux'
44+
run: npm run test:headless
45+
env:
46+
CI: true
47+
48+
build:
49+
needs: test
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '22'
60+
cache: 'npm'
61+
62+
- name: Install global dependencies
63+
run: npm install -g typescript vsce
64+
65+
- name: Install dependencies
66+
run: npm ci
67+
68+
- name: Compile TypeScript
69+
run: npm run compile
70+
71+
- name: Package extension
72+
run: vsce package
73+
74+
- name: Upload VSIX
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: vscode-pandoc-vsix
78+
path: "*.vsix"

.github/workflows/todo.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
on:
2+
push:
3+
branches: [main]
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: TODO to Issue
14+
uses: alstr/todo-to-issue-action@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ out
5353
*.vsix
5454
.gitignore
5555
.editorconfig
56+
.vscode-test

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,57 @@ If needed, you can also change the default Pandoc docker image using the `pandoc
144144
- January 16, 2016
145145
- Handling of the path that contains spaces
146146
- Add the open command (xdg-open) in linux
147+
148+
## Development
149+
150+
### Running Tests
151+
152+
This extension includes a test suite. To run the tests:
153+
154+
```bash
155+
# Install dependencies
156+
npm install
157+
158+
# Compile TypeScript
159+
npm run compile
160+
161+
# Run tests locally (opens VS Code Extension Host)
162+
npm test
163+
164+
# Run tests in headless mode (useful for CI)
165+
npm run test:headless
166+
167+
# Run tests on Linux with virtual framebuffer (CI)
168+
npm run test:ci
169+
```
170+
171+
### Test Structure
172+
173+
The test suite includes:
174+
175+
- **Configuration Tests**: PDF options, format options, executable paths.
176+
- **Docker Configuration Tests**: Migration and execution scenarios.
177+
- **Platform-Specific Tests**: Cross-platform command handling.
178+
- **Integration Tests**: Full workflow testing.
179+
- **Error Handling Tests**: Missing dependencies, execution failures.
180+
181+
### Building
182+
183+
```bash
184+
# Compile TypeScript
185+
npm run compile
186+
187+
# Watch mode for development
188+
npm run watch
189+
190+
# Package the extension
191+
npm run package
192+
```
193+
194+
### CI/CD
195+
196+
The project uses GitHub Actions for continuous integration:
197+
198+
- Tests run on Ubuntu, Windows, and macOS.
199+
- Tests run on Node.js versions 18, 20, and 22.
200+
- Automatic VSIX packaging and artifact upload.

0 commit comments

Comments
 (0)