nrwl / nx

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

Unable to run component test in parallel #28737

Open jasedwards opened 6 days ago

jasedwards commented 6 days ago

Current Behavior

When running the cypress executor in my CI (azure devops) the parallel flag is not passed into cypress. I have followed the instructions for passing args and it still does not work. The following is everything I have tried along with the error message which is the same for each try.

in the yaml:

     - script: |
          npx nx component-test test-app --args=\"--parallel\" --record --tag ${{parameters.tagName}} --env.grepTags=${{parameters.grep}} --env.grepFilterSpecs=${{parameters.grepFilterSpecs}} --env.grepOmitFiltered=${{parameters.grepFilterSpecs}} --ci-build-id $(Build.BuildId)_$(System.JobAttempt)

and

     - script: |
          npx nx component-test test-app --args="--parallel" --record --tag ${{parameters.tagName}} --env.grepTags=${{parameters.grep}} --env.grepFilterSpecs=${{parameters.grepFilterSpecs}} --env.grepOmitFiltered=${{parameters.grepFilterSpecs}} --ci-build-id $(Build.BuildId)_$(System.JobAttempt)

and in project.json

    "component-test": {
      "executor": "@nx/cypress:cypress",
      "options": {
        "args": ["--parallel"],
        "cypressConfig": "apps/test-app/cypress.config.ts",
        "testingType": "component",
        "skipServe": true,
        "devServerTarget": "test-app:build"
      }
    }

Expected Behavior

I should be able to run component tests in parallel

GitHub Repo

No response

Steps to Reproduce

  1. Run the above commands in azure devops?

Nx Report

Node : 20.18.0 OS : win32-x64 npm : 10.8.3

nx (global) : 17.3.0 nx : 18.2.4 @nx/js : 18.2.4 @nx/jest : 18.2.4 @nx/linter : 18.2.4 @nx/eslint : 18.2.4 @nx/workspace : 18.2.4 @nx/angular : 18.2.4 @nx/cypress : 18.2.4 @nx/devkit : 18.2.4 @nx/eslint-plugin : 18.2.4 @nx/plugin : 18.2.4 @nrwl/tao : 18.2.4 @nx/web : 18.2.4 @nx/webpack : 18.2.4 typescript : 5.2.2

Community plugins: @ng-bootstrap/ng-bootstrap : 16.0.0 @ngrx/component-store : 17.1.1 @ngrx/effects : 17.1.1 @ngrx/entity : 17.1.1 @ngrx/router-store : 17.1.1 @ngrx/schematics : 17.1.1 @ngrx/store : 17.1.1 @ngrx/store-devtools : 17.1.1 eslint-plugin-ngrx : 2.1.4 ngx-toastr : 17.0.2

Local workspace plugins: @clearsight-apps/schematics

Failure Logs

Generating script. Script contents: npx nx component-test test-app --args=\"--parallel\" --record --tag GatedCommit --env.grepTags=@test --env.grepFilterSpecs=true --env.grepOmitFiltered=true --ci-build-id 266855_1 | tee cypress-output.txt ========================== Starting Command Output =========================== /usr/bin/bash --noprofile --norc /home/vsts/work/_temp/c9092e55-407f-4c03-8ff3-22674b7017d8.sh

nx run test-app:component-test --args="--parallel" --record --tag GatedCommit --env.grepTags=@test --env.grepFilterSpecs=true --env.grepOmitFiltered=true --ci-build-id 266855_1

[2078:1031/192225.947951:ERROR:node_bindings.cc(305)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details. DevTools listening on ws://127.0.0.1:39883/devtools/browser/1d97b34f-c100-4049-b8ad-ff995da90e38 Browserslist: caniuse-lite is outdated. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme

Package Manager Version

No response

Operating System

Additional Information

I am using an ubuntu vm image.

jasedwards commented 2 days ago

Would also like to point out that I have stepped through the executor and I can't see anywhere that it even cares or checks for args.something. args.parallel is listed as overrides in the run.js file but there is a property for parallel set to false already. I tried to debug further but get lost and can't actually find the starting point to debug. I feel like I followed your documentation as much as I possibly could so any acknowledgment that this has been seen or a suggestion on what I did wrong would be appreciated. I am currently blocked on this and there does not seem to be any more info anywhere.

jasedwards commented 15 hours ago

After digging around more in the docs I think now args only works if I use inferred tasks? So a few more questions.

  1. Is this true, and if so is it just not possible to run parallel in cypress cloud calling nx compoent-test?
  2. I was able to switch to inferred tasks only after changing my cypress.config file to the most basic possible. With my custom file it would not find my project?
  3. I can't find any documentation whatsoever on how to actually use the inferred plugin. At this point I have looked at all the spec files and code in the nx repo just trying to see how it's used but still can't run it.

If somebody would be so kind as to respond to this and tell me if anything I am trying to do is even possible then I could stop wasting my time.