Skip to content

Commit

Permalink
Mocha pass if err code is PASS (#6)
Browse files Browse the repository at this point in the history
* check code value to see if mocha test pass

* Check for code equals PASS
  • Loading branch information
olih authored Feb 18, 2023
1 parent 3304b1e commit 66e885a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion baldrick-broth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
model:
project:
title: Build automation tool and task runner
version: 0.5.0
version: 0.6.0
description:
Take your developer workflow to the next level with a custom CLI with relevant documentation for running your task
readme:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"CLI",
"Regression tests"
],
"version": "0.5.0",
"version": "0.6.0",
"author": {
"name": "Olivier Huin",
"url": "https://github.com/olih"
Expand Down
2 changes: 1 addition & 1 deletion src/ci-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const ciReportStartSuite = (title: string, secondary: string) => {
console.group(`${title}; ${secondary}`);
};
export const ciReportStepCase = (reportingCase: ReportingCase) => {
if (reportingCase.err === undefined) {
if (reportingCase.err.code === 'PASS') {
console.error(
`✓ PASS ${reportingCase.title} ${reportingCase.snapshotFile}`
);
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ program

export async function runClient() {
try {
program.parseAsync();
await program.parseAsync();
console.log(`✓ Done. Version ${version}`);
} catch (error) {
console.log('baldrick-pest will exit with error code 1');
Expand Down
4 changes: 2 additions & 2 deletions src/mocha-json-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { PestFileSuiteOpts } from './run-opts-model.js';

const expandReportTracker = (opts: PestFileSuiteOpts): FullReport => {
const passes = opts.reportTracker.tests.filter(
(test) => test.err === undefined
(test) => test.err.code === 'PASS'
);
const failures = opts.reportTracker.tests.filter(
(test) => test.err !== undefined
(test) => test.err.code !== 'PASS'
);
const duration = opts.reportTracker.tests.reduce(
(sum, t) => sum + t.duration,
Expand Down
2 changes: 1 addition & 1 deletion src/pretty-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const addRun = (run: string) =>
run.length < 20 ? colors.run(run) : colors.run(run.slice(0, 20) + '...');

export const prettyReportStepCase = (reportingCase: ReportingCase) => {
if (reportingCase.err === undefined) {
if (reportingCase.err.code === 'PASS') {
console.error(
colors.pass('✓ PASS') +
' ' +
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '0.5.0';
export const version = '0.6.0';

0 comments on commit 66e885a

Please sign in to comment.