- Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
The tap reporter swallows failures which occur within the hooks:
https://github.com/avajs/ava/blob/v2.3.0/lib/reporters/tap.js#L144
The failure is being recorded as a comment, which will be ignored by a tap parser. This means that after parsing it the run will be considered a pass if there was a problem in the hooks that prevented a test from running.
In our use case tests need to setup accounts before executing. When a PR is made and the tests run, we don't want the test to pass if it can't be executed, it should be marked as a failure for us to look into.
Test Source
test.serial.beforeEach('Auto failure in hook', () => {throw new Error('Simulated failure');});
Error Message & Stack Trace
# Failed hook: Setup accounts for The test name
Config
Copy the relevant section from package.json
:
{ "ava": { "compileEnhancements": false, "extensions": [ "ts" ], "require": [ "ts-node/register" ] } }
Command-Line Arguments
Copy your npm build scripts or the ava
command used:
$(npm bin)/ava --tap --timeout=3m -c 8 -t dist/test/*.js
Relevant Links
- If your project is public, link to the repo so we can investigate directly.
- BONUS POINTS: Create a minimal reproduction and upload it to GitHub. This will get you the fastest support.
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())" local: darwin 18.6.0 Same issue in other linux based environments ava --version v2.3.0 npm --version 6.4.1