Fix template building issue #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install packages | |
run: npm ci | |
- name: Test | |
run: npm run build | |
- uses: ./ | |
id: run-action | |
with: | |
files: .github/workflows/test-data/junit.xml | |
upload-report: false | |
- name: Verify output | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const assert = require('assert').strict; | |
const data = JSON.parse('${{ steps.run-action.outputs.test-results }}'); | |
assert.strictEqual(data.name, 'unit-test', 'project name'); | |
// test summary | |
assert.strictEqual(data.summary.duration, 2.017, 'summary duration'); | |
assert.strictEqual(data.summary.tests, 2, 'summary total tests'); | |
assert.strictEqual(data.summary.passed, 1, 'summary passed'); | |
assert.strictEqual(data.summary.failed, 1, 'summary failed'); | |
assert.strictEqual(data.summary.skipped, 0, 'summary skipped'); | |
// test suites | |
assert.strictEqual(data.suites.length, 1, 'test suite count'); | |
assert.strictEqual(data.suites[0].duration, 2.017, 'summary duration'); | |
assert.strictEqual(data.suites[0].tests, 2, 'summary total tests'); | |
assert.strictEqual(data.suites[0].passed, 1, 'summary passed'); | |
assert.strictEqual(data.suites[0].failed, 1, 'summary failed'); | |
assert.strictEqual(data.suites[0].skipped, 0, 'summary skipped'); |