nrwl / nx

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

nx run with positional arguments regression with 15.8.x #15697

Closed Anglagard closed 11 months ago

Anglagard commented 1 year ago

Current Behavior

This command is generated by Intellij's karma runner plugin : nx run ui-nativescript:test --karma-config /Applications/IntelliJ IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js --source-map --code-coverage

When running with nx 15.7.2 it works fine, but not anymore with nx 15.8.x

Expected Behavior

The command should run like before 15.8.x

GitHub Repo

No response

Steps to Reproduce

Create an angular project my-project with karma tests. Use the Intellij plugin to launch karma.conf or use the generated command : nx run my-project:test --karma-config /Applications/IntelliJ IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js --source-map --code-coverage

Nx Report

Node : 16.13.2
   OS   : darwin x64
   npm  : 7.24.2

   nx                      : 15.8.6
   @nrwl/js                : 15.8.6
   @nrwl/jest              : 15.8.6
   @nrwl/linter            : 15.8.6
   @nrwl/workspace         : 15.8.6
   @nrwl/angular           : 15.8.6
   @nrwl/cli               : 15.8.6
   @nrwl/cypress           : 15.8.6
   @nrwl/devkit            : 15.8.6
   @nrwl/eslint-plugin-nx  : 15.8.6
   @nrwl/tao               : 15.8.6
   @nrwl/webpack           : 15.8.6
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   rxjs             : 6.6.7
   @nativescript/nx : 4.2.0
   ng-mocks         : 14.7.1

Failure Logs

> nx run ui-nativescript:test --karma-config /Applications/IntelliJ IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js --source-map --code-coverage

 >  NX   Schema does not support positional arguments. Argument 'IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js' found

 >  NX   Ran target test for project ui-nativescript (327ms)

         With additional flags:
           IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js
           --karma-config=/Applications/IntelliJ
           --source-map=true
           --code-coverage=true

    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Additional Information

No response

AgentEnder commented 1 year ago

It looks like this is breaking because your apps path has a space in it, can you try wrapping that path in quotes?

Anglagard commented 1 year ago

Unfortunately no, the command line is generated by the karma IntelliJ plugin.

Anglagard commented 1 year ago

The original command generated by IntelliJ's plugin is : /usr/local/bin/node /Users/xxxxxxxxx/IdeaProjects/nfe-nx/node_modules/@angular/cli/bin/ng test --karma-config /Applications/IntelliJ IDEA.app/Contents/plugins/karma/js_reporter/karma-intellij/lib/intellij.conf.js --source-map --skip-nx-cache

Anglagard commented 1 year ago

The problem comes from the modified function rewritePositionalArguments in nx/bin/init-local.ts. The old function in 15.7.2 works fine :

function rewritePositionalArguments(args) { if (!args[3] || args[3].startsWith('-')) { return ['run', ${wrapIntoQuotesIfNeeded(args[2])}, ...args.slice(3)]; } else { return [ 'run', ${args[3]}:${wrapIntoQuotesIfNeeded(args[2])}, ...args.slice(4), ]; } }

github-actions[bot] commented 1 year 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! 🙏

github-actions[bot] commented 10 months ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.