Skip to content

Fix template building issue #14

Fix template building issue

Fix template building issue #14

Workflow file for this run

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');