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 [test] target: environment should ignore other environment specific tests #1097

Open
whizzzkid opened this issue Oct 20, 2022 · 3 comments

Comments

@whizzzkid
Copy link
Contributor

Describe the bug
The test runner produces the following pattern for testing:

<test-cmd> [
  'test/<target-env>.{js,cjs,mjs}',
  'test/**/*.spec.{js,cjs,mjs}',
  'dist/test/<target-env>.{js,cjs,mjs}',
  'dist/test/**/*.spec.{js,cjs,mjs}',
]

but *.spec.{js,cjs,mjs} already includes everything, so if the environment is node it would also end up running test for browser it should ignore browser

To Reproduce
in the tests folder, create test:

  • node.spec.js
  • browser.spec.js
  • test.spec.js

Run tests: aegir test --target node.

Expected behavior

Only the following tests should Run:

  • node.spec.js
  • test.spec.js

Instead all three run.

@achingbrain
Copy link
Member

Most modules that use aegir have isomorphic tests that match *.spec.js. Some modules do not, they have, for example node.js that imports node tests and browser.js that imports browser tests. These environment-specific tests aren't usually named *.spec.js.

@RonaldZielaznicki
Copy link

One of the things that has bothered me about the current method of using node.js or browser.js files is it is difficult to run individual test files for given environments.

For example, if I wanted to run the tests for "build" in aegir, I'd have to run mocha directly against the test file after making sure all the usual set up is correct.

So, rather than running the tests just for build I run the tests for everything just to run the tests for build.

@achingbrain
Copy link
Member

achingbrain commented Jun 10, 2023

it is difficult to run individual test files for given environments

You can do something like this:

$ aegir test -t node --grep 'build'

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

3 participants