Jest
Jest is a delightful JavaScript Testing Framework with a focus on simplicity.It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more! Jest can generate standard format JUnit-style XML files which can be submited to Testfiesta or Testrail using taco truck cli. You just need to install the popular jest-junit
package and install tacotruck cli or use Github action. Check out simple jest example.
Configuration
To generate xml report file output, folder and file name should be configured in config file
//jest.config.js
/** @type {import('jest').Config} */
const config = {
reporters: [
'default',
['jest-junit', {outputDirectory: 'reports', outputName: 'test-results.xml'}],
],
};
module.exports = config;
Install Tacotruck CLI
$ npm install -g @testfiesta/tacotruck
Submit test results
tacotruck testfiesta \
run:submit \
--token testfiesta_... \
--handle orgHandle \
--project projectKey \
--name runName \
--data results-path/*.xml
Github action
name: jest
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./demo-jest-tf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: 📦 Install dependencies
run: npm install
- name: 🧪 Test
run: npm run test
- name: Report Results
if: false
uses: testfiesta/tacotruck-action@v1
with:
provider: testfiesta
handle: handle
project: project
base-url: https://staging.api.testfiesta.com
credentials: ${{ secrets.TESTFIESTA_API_KEY }}
run-name: Jest CI run ${{ github.run_number }}
results-path: ./demo-jest-tf/reports/test-results.xml
Last updated