bug: `aegir test --bail` doesn't adhere to build configuration
SgtPooki opened this issue · 2 comments
Describe the bug
Running tests with npx aegir test --bail false
flag will not trigger aegir build
which would be otherwise triggered by npx aegir test
To Reproduce
Steps to reproduce the behavior:
- Go to any project configured with aegir build and test, such as https://github.com/ipfs/helia-verified-fetch
- run
npm run clean
to ensuredist
folder is removed - run
npm run test
and see that tests run successfully after building - run
npm run clean
to ensure thatdist
folder is removed - run
npm run test -- --bail false
and see the below error message:Error: No test files found

Expected behavior
I expect the same test flow to occur, though mocha should no longer bail for any given test.
Additional context
I have been running some tests with DEBUG="test*,test*:trace" npm run test -- -g 'abort-handling'
and then running DEBUG="test*,test*:trace" npm run test -- -g 'abort-handling' --bail false
while changing some things. When running tests without the bail flag, aegir builds my tests and then runs the tests as expected. With it, aegir does not rebuild the src & tests.
Also noticed that we have an alias conflict -b
is for both --bail
and --build
:
╰─ ✔ ❯ npm run test -- --help
> @helia/verified-fetch@1.3.3 test
> aegir test --help
aegir test
Test your code in different environments
Global Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
-d, --debug Show debug output. [boolean] [default: false]
Options:
-b, --build Build the project before running the tests
[boolean] [default: true]
--types If a tsconfig.json is present in the project, run tsc.
[boolean] [default: true]
-t, --target In which target environment to execute the tests
[array] [choices: "node", "browser", "webworker", "electron-main", "electron-r
enderer", "react-native-android", "react-native-ios"] [default: ["node","brows
er","webworker"]]
-w, --watch Watch files for changes and rerun tests
[boolean] [default: false]
-f, --files Custom globs for files to test [array] [default: []]
--timeout The default time a single test has to run
[number] [default: 60000]
-g, --grep Limit tests to those whose names match given pattern[string]
-b, --bail Mocha should bail once a test fails
[boolean] [default: false]
--progress Use progress reporters on mocha and karma
[boolean] [default: false]
--cov Enable coverage output. Output is already in Istanbul JSON f
ormat and can be uploaded directly to codecov.
[boolean] [default: false]
--covTimeout How long to wait for coverage collection. Workaround for htt
ps://github.com/ipfs/aegir/issues/1206
[number] [default: 60000]
The alias conflict is probably what's causing this 😢