-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Fail if more scenarios fail (#106)
Added new steps into the test.yml workflow. 1. upload results as an artifact 2. downloads most recent push to master's test results and compares them.
- Loading branch information
1 parent
321fed1
commit 776b77c
Showing
7 changed files
with
103 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const fs = require("fs"); | ||
|
||
const log = require("../src/log.js"); | ||
|
||
log.setLogLevel(log.logLevels.verbose); | ||
|
||
// Extract cl arguments | ||
const clArgs = process.argv.slice(2); | ||
|
||
if (clArgs.length !== 2) { | ||
log.error("Incorrect number of arguments"); | ||
process.exit(1); | ||
} | ||
|
||
const resultType = ["New", "Previous"]; | ||
let results = []; | ||
|
||
for (let ii = 0; ii < 2; ii++) { | ||
try { | ||
results[ii] = JSON.parse(fs.readFileSync(clArgs[ii], "utf-8")); | ||
log.verbose( | ||
`${log.underline}${resultType[ii]} test results${log.resetStyling}` | ||
); | ||
log.verbose(results[ii]); | ||
} catch (ee) { | ||
log.error(clArgs[ii] + " : " + ee.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
Object.entries(results[1]).forEach(([language, oldResult]) => { | ||
let newResult; | ||
if ((newResult = results[0][language]) != undefined) { | ||
let limit = newResult.scenarios > oldResult.scenarios; | ||
if (limit < 0) limit = 0; | ||
if (newResult.failed - oldResult.failed > limit) { | ||
log.error( | ||
`${language} ${log.redBackground}${log.blackForeground} FAILED ${log.resetStyling}` | ||
); | ||
log.verbose("There are more newly failing tests than added test."); | ||
log.verbose( | ||
"This is an indication that an existing test is now failing." | ||
); | ||
process.exit(1); | ||
} | ||
} | ||
}); | ||
|
||
process.exit(0); |
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
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
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
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
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