Skip to content

Commit

Permalink
add npm-test action
Browse files Browse the repository at this point in the history
use junit output
  • Loading branch information
joshmarinacci committed Oct 11, 2024
1 parent c5141c4 commit a3216b2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Unit Tests

on:
schedule:
- cron: 0 */6 * * *
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: install deps
run: npm ci

- name: run tests
run: npm run mocha-test

- name: upload tests
run: |
curl -fsSL --retry 3 "https://github.com/trunk-io/analytics-cli/releases/latest/download/trunk-analytics-cli-x86_64-unknown-linux.tar.gz" | tar -xvz > ./trunk-analytics-cli
./trunk-analytics-cli upload --junit-paths "tests/jest/jest_junit_test.xml" --org-url-slug ${TRUNK_ORG_SLUG} --token ${TRUNK_API_TOKEN}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"scripts": {
"test": "npm run vitest && npm run type-check",
"vitest": "vitest run --dir test",
"vitest": "vitest run --dir test --reporter=junit --outputFile=test-output.xml",
"build": "node build.js",
"type-check": "tsc",
"clean": "rm -rf dist/ output/ *.tgz",
Expand Down

0 comments on commit a3216b2

Please sign in to comment.