Skip to content

Commit

Permalink
circleci: publish test reports (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn authored Mar 18, 2024
1 parent 5be9ed7 commit 68e374e
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ jobs:
- run: make check-file-headers
- run: npm ci --legacy-peer-deps
- run: node lib/bin/create-docker-databases.js
- run: make test

- run: make test-ci
- store_test_results:
path: ./junit-reports
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ node_modules/
/.eslintcache
/.pgbadger/
.vscode
/junit-reports/
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ debug: base
test: lint
BCRYPT=insecure npx mocha --recursive --exit

.PHONY: test-ci
test-ci: lint
BCRYPT=insecure npx mocha --recursive --exit --reporter test/ci-mocha-reporter.js

.PHONY: test-fast
test-fast: node_version
BCRYPT=insecure npx mocha --recursive --exit --fgrep @slow --invert
Expand Down
155 changes: 155 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"fetch-cookie": "^2.1.0",
"lodash": "^4.17.21",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"nock": "^13.3.1",
"node-fetch": "^2.7.0",
"node-mocks-http": "^1.12.2",
Expand Down
21 changes: 21 additions & 0 deletions test/ci-mocha-reporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 ODK Central Developers
// See the NOTICE file at the top-level directory of this distribution and at
// https://github.com/getodk/central-backend/blob/master/NOTICE.
// This file is part of ODK Central. It is subject to the license terms in
// the LICENSE file found in the top-level directory of this distribution and at
// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central,
// including this file, may be copied, modified, propagated, or distributed
// except according to the terms contained in the LICENSE file.
//
// Contains tasks that manipulate the database, primarily dumping and restoring
// for backups. See ./task.js for more information on what tasks are.

/* eslint-disable no-new */

const mocha = require('mocha');
const MochaJunitReporter = require('mocha-junit-reporter');

module.exports = function CiMochaReporter(runner) {
new mocha.reporters.Spec(runner);
new MochaJunitReporter(runner, { reporterOptions: { mochaFile: './junit-reports/test-results.xml' } });
};

0 comments on commit 68e374e

Please sign in to comment.