Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: aegir test --bail doesn't adhere to build configuration #1488

Open
SgtPooki opened this issue Mar 21, 2024 · 2 comments
Open

bug: aegir test --bail doesn't adhere to build configuration #1488

SgtPooki opened this issue Mar 21, 2024 · 2 comments

Comments

@SgtPooki
Copy link
Member

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:

  1. Go to any project configured with aegir build and test, such as https://github.com/ipfs/helia-verified-fetch
  2. run npm run clean to ensure dist folder is removed
  3. run npm run test and see that tests run successfully after building
  4. run npm run clean to ensure that dist folder is removed
  5. run npm run test -- --bail false and see the below error message: Error: No test files found
image

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.

@SgtPooki SgtPooki changed the title bug: bail doesn't adhere to "build" configuration bug: aegir test --bail doesn't adhere to build configuration Mar 21, 2024
@SgtPooki
Copy link
Member Author

SgtPooki commented Apr 2, 2024

Also noticed that we have an alias conflict -b is for both --bail and --build:

╰─ ✔ ❯ npm run test -- --help

> @helia/[email protected] 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]

@achingbrain
Copy link
Member

The alias conflict is probably what's causing this 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants