Skip to content

Commit 511740f

Browse files
committed
Set up a unit testing workflow
1 parent 34afcb6 commit 511740f

File tree

5 files changed

+102
-1
lines changed

5 files changed

+102
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
31+
32+
**Smartphone (please complete the following information):**
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
38+
39+
**Additional context**
40+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/workflows/unit_tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Unit tests
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
jobs:
5+
test:
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
os: [windows-latest, ubuntu-latest]
10+
node-version: [16, 18]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Install Node
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- name: Install dependencies
19+
run: yarn install
20+
- name: Test
21+
run: yarn run test run --reporter verbose
22+
coverage:
23+
needs: "test"
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Install Node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
- name: Install dependencies
32+
run: yarn install
33+
- name: Generate coverage report
34+
run: yarn run coverage
35+
- name: Upload coverage reports to Codecov with GitHub Action
36+
uses: codecov/codecov-action@v3

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"format": "prettier --write .",
3030
"test": "vitest",
3131
"clean": "rimraf dist",
32-
"copy-files": "copyfiles pulumi/** dist"
32+
"copy-files": "copyfiles pulumi/** dist",
33+
"coverage": "vitest run --coverage"
3334
},
3435
"devDependencies": {
3536
"@pulumi/aws": "^5.32.0",
@@ -40,6 +41,7 @@
4041
"@types/mime": "^3.0.1",
4142
"@types/minimist": "^1.2.2",
4243
"@types/node": "18.14.0",
44+
"@vitest/coverage-c8": "^0.29.8",
4345
"copyfiles": "^2.4.1",
4446
"folder-hash": "^4.0.4",
4547
"lodash": "^4.17.21",

vitest.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ import { defineConfig } from 'vitest/config'
33
export default defineConfig({
44
test: {
55
globals: true,
6+
coverage: {
7+
reporter: ['text', 'lcov'],
8+
all: true
9+
},
610
},
711
})

0 commit comments

Comments
 (0)