nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.35k stars 2.33k forks source link

`nx:affected test` does not pass all command-line arguments to all command invocations #17823

Open gkamperis opened 1 year ago

gkamperis commented 1 year ago

Current Behavior

We have a large monorepo with a mix of jest and karma test suits.

For karma we have customLaunchers

// karma.conf.js
{
customLaunchers : { CustomChromeBrowser : { base: 'ChromeHeadless', flags: [...] 
// our default
browsers: [ 'Chrome']
}

After migrating to v16.3.2 the command
nx:affected test --parallel --browsers="CustomChromeBrowser" on some projects is attempting to launch Chrome instead of CustomChromeBrowser As we are running in CI and Chrome is not allowed (only headless is) this leads to failure.

Anyhow, the issue is that the --browsers flag is lost in the process.

A total assumption on my part: I suspect that at some point some logic removes it because maybe it is not valid for jest? or because of some sort of failure it picks up the default?

Anyway, this is an assumption of course but there is definitely a bug somewhere where flags are not propagated correctly when you have mixed targets that do not all support the same flags/arguments.

Expected Behavior

I expect all flags to be passed to all calls of the test target

This was working fine at least in v15.1.1

GitHub Repo

No response

Steps to Reproduce

It is not easy for me to provide a reproduction repo.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 19.3.0
   npm    : 9.2.0

   nx                 : 16.3.2
   @nx/js             : 16.3.2
   @nx/jest           : 16.3.2
   @nx/linter         : 16.3.2
   @nx/workspace      : 16.3.2
   @nx/angular        : 16.3.2
   @nx/cypress        : 16.3.2
   @nx/devkit         : 16.3.2
   @nx/eslint-plugin  : 16.3.2
   @nrwl/tao          : 16.3.2
   @nx/web            : 16.3.2
   @nx/webpack        : 16.3.2
   typescript         : 5.0.4

Failure Logs

No response

Operating System

Additional Information

No response

tino-tg commented 1 year ago

Is it possible that it works with nx:affected test --parallel -- --browsers="CustomChromeBrowser" ?

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

gkamperis commented 7 months ago

bump