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

Running nx affected --target=test runs no tests in Azure #2820

Closed
4 tasks done
adover opened this issue Apr 6, 2020 · 5 comments
Closed
4 tasks done

Running nx affected --target=test runs no tests in Azure #2820

adover opened this issue Apr 6, 2020 · 5 comments

Comments

@adover
Copy link

adover commented Apr 6, 2020

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation (nx.dev) and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (not related to React, Angular or any dependency)

Expected Behavior

Please describe the behavior you are expecting
When I run

nx affected --target=test --base=origin/master --parallel --maxParallel=5 --passWithNoTests

In an Azure pipeline it should run against all affected tests, or all, if it has no memory of previous tests.

Current Behavior

It currently runs in 4s with the message

NX  No projects with "test" were run

I've also tried with various connotations of the repo, using head and the like, but no success.

Context

Please provide any relevant information about your setup:

  @nrwl/angular : 9.2.1
  @nrwl/cli : 9.2.1
  @nrwl/cypress : 9.2.1
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 9.2.0
  @nrwl/linter : Not Found
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 9.2.1
  @nrwl/web : Not Found
  @nrwl/workspace : 9.2.1
  typescript : 3.8.3

Failure Logs

Please include any relevant log snippets or files here.

Other

Any other relevant information that will help us help you.

@elvirdolic
Copy link

Maybe it's related to this: #2472 I have found out that affected output is different on linux and windows build agents.

on linux it seems to work the right way you may try out ...

@cvocvo
Copy link

cvocvo commented Jun 2, 2020

Also running into this same issue; not sure how to solve it. We have 12 test classes and it doesn't run any of them with this command.

image

When we run nx affected:test --all --parallel --maxParallel=12 it results in all test classes being run even though only a few classes across the 12 test projects were modified.

Edit:
After running nx affected:test --all --parallel --maxParallel=12 we did get caching going which looks different versus the output above. The first screenshot made us just assume that caching was happening / no local changes were detected which isn't correct.
image
In that screenshot the --all does cause caching if the tests have already been run and passed.

I think what's happening is that the scoping of 'local dev' and a local build for deploy or continuous integration is different. This is scoped (my term) at several levels: affected, test and all are all distinct things. Affected is different than Run-Many and test, if you have multiple test projects, may require all for a local/CI build to force all the tests to run.
You can also run nx affected:test --base=master~1 --head=master --parallel --maxParallel=4 as a quick experiment to understand what's happening under the hood with NX.
The documentation here (https://nx.dev/angular/cli/affected-test) didn't make the lightbulb go off, but looking at the reasoning/commentary in the readme here really made it click: https://github.com/nrwl/nx-azure-build

@philipjfulcher
Copy link
Collaborator

I'm circling back to some of these issues related to differences between Windows/Linux/Mac OS and I think they're resolved in our latest version of Nx 9 and 10. Are you able to update your repo to 9.6 or 10.1 to see if that resolves the issue?

@philipjfulcher
Copy link
Collaborator

This should be fixed in the latest version of 9.x and 10.x of Nx. Please open another bug if you see it again after upgrading to the latest version.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants