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] check-module-boundaries.js adds significant time to test workflows #841

Open
Tungsten78 opened this issue Mar 26, 2024 · 0 comments
Open
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member

Comments

@Tungsten78
Copy link
Contributor

Current Behavior

There is considerable overhead added to TDD style dev/test workflows (most often using VS Test Explorer):

  • check-module-boundaries.js is included as a BeforeBuild target in Directory.Build.targets

Context:

Scenario Elapsed Time
(default case) With fallback 17s
Using .nx-dotnet.rc.json (empty rule set) 11s
Without Remove target from Directory.Build.targets 9s

Note: related to #829

  • 2.1.1 is being used here
  • Will retest with 2.2.0, expect to see improvement since build cache can be better leveraged; however overhead concern is not eliminated
    • Test Explorer does not invoke nx

Expected Behavior

Boundaries checks should not interfere with test workflows (expect little to no overhead).

  • Boundary checks might be better served in a linting workflow to be consistent with other project types
  • Might it make sense to merge this into the existing "lint" target - format + boundary checks?

Github Repo

No response

Steps to Reproduce

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.10.0
   OS     : win32-x64
   npm    : 10.5.0

   nx (global)        : 17.1.2
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/angular        : 17.2.8
   @nx/cypress        : 17.2.8
   @nx/devkit         : 17.0.2
   @nx/eslint-plugin  : 17.2.8
   @nrwl/tao          : 17.2.8
   @nx/web            : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @auth0/auth0-angular         : 2.2.1
   @ngrx/component              : 17.0.1
   @ngrx/component-store        : 17.0.1
   @nx-dotnet/core              : 2.1.1
   @nx-tools/nx-container       : 5.1.0
   @nxlv/python                 : 17.0.0
   @trumbitta/nx-plugin-openapi : 1.12.1
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nx/devkit@17.0.2
     - @nrwl/devkit@17.0.2

   To fix this, run `nx migrate nx@17.2.8`

nx.json

{
  "plugins": ["@nx-dotnet/core", "@nxlv/python", "@nx-tools/nx-container"],
  "workspaceLayout": {
    "projectNameAndRootFormat": "derived",
    "appsDir": "apps",
    "libsDir": "libs"
  },
  "namedInputs": {
    "default": ["{projectRoot}/**/*", "sharedGlobals"],
    "production": [
      "default",
      "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/jest.config.[jt]s",
      "!{projectRoot}/.eslintrc.json",
      "!{projectRoot}/cypress/**/*",
      "!{projectRoot}/**/*.cy.[jt]s?(x)",
      "!{projectRoot}/cypress.config.[jt]s",
      "!{projectRoot}/src/test-setup.[jt]s"
    ],
    "sharedGlobals": []
  },
  "targetDefaults": {
    "serve": {
      "dependsOn": ["codegen", "^codegen"],
      "inputs": ["production", "^production"]
    },
    "build": {
      "dependsOn": ["^build", "codegen", "^codegen"],
      "inputs": ["production", "^production"],
      "cache": true
    },
    "component-test": {
      "inputs": ["default", "^production"],
      "outputs": ["{projectRoot}/cypress/results"],
      "cache": true
    },
    "test": {
      "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
      "outputs": [
        "{projectRoot}/junit.xml",
        "{projectRoot}/test-results.xml",
        "{workspaceRoot}/coverage/{projectRoot}"
      ],
      "cache": true
    },
    "e2e": {
      "inputs": ["default", "^production"],
      "outputs": ["{projectRoot}/cypress/results"],
      "cache": true
    },
    "@nx-dotnet/core:build": {
      "dependsOn": ["^build", "codegen", "^codegen"],
      "inputs": [
        "default",
        "production",
        "^production",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/Directory.Build.props",
        "{workspaceRoot}/Directory.Build.targets",
        "{workspaceRoot}/Directory.Packages.props"
      ],
      "cache": true
    },
    "@nx-dotnet/core:test": {
      "inputs": [
        "default",
        "^production",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/Directory.Build.props",
        "{workspaceRoot}/Directory.Build.targets",
        "{workspaceRoot}/Directory.Packages.props"
      ],
      "outputs": ["{projectRoot}/TestResults"],
      "cache": true
    },
    "@nxlv/python:build": {
      "options": {
        "outputPath": "{workspaceRoot}/dist/{projectRoot}"
      }
    },
    "publish": {
      "cache": true
    },
    "lint": {
      "cache": true
    },
    "swagger": {
      "cache": true
    },
    "codegen": {
      "cache": true
    },
    "preview": {
      "cache": true
    },
    "@nx/jest:jest": {
      "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
      "outputs": [
        "{projectRoot}/junit.xml",
        "{projectRoot}/test-results.xml",
        "{workspaceRoot}/coverage/{projectRoot}"
      ],
      "cache": true,
      "options": {
        "passWithNoTests": true
      },
      "configurations": {
        "ci": {
          "ci": true,
          "codeCoverage": true
        }
      }
    }
  },
  "affected": {
    "defaultBase": "master"
  },
  "generators": {
    "@nx-dotnet/core:application": {
      "language": "C#",
      "template": "webapi",
      "testTemplate": "xunit",
      "tags": "type:app"
    },
    "@nx-dotnet/core:library": {
      "language": "C#",
      "template": "classlib",
      "testTemplate": "xunit"
    },
    "@nx/angular:application": {
      "style": "scss",
      "linter": "eslint",
      "unitTestRunner": "jest",
      "e2eTestRunner": "none",
      "addTailwind": true,
      "standalone": true,
      "inlineTemplate": true,
      "inlineStyle": true,
      "skipTests": true,
      "tags": "type:app"
    },
    "@nx/angular:library": {
      "linter": "eslint",
      "unitTestRunner": "jest",
      "style": "scss",
      "skipModule": true,
      "standalone": true,
      "inlineTemplate": true,
      "inlineStyle": true,
      "skipTests": true
    },
    "@nx/angular:component": {
      "style": "scss",
      "standalone": true,
      "changeDetection": "OnPush",
      "inlineTemplate": true,
      "inlineStyle": true,
      "flat": true,
      "skipTests": true
    }
  },
  "nxCloudAccessToken": "REDACTED",
  "parallel": 3
}

Failure Logs

***DEFAULT RUN***

 nx-vigil  nx test trends-api-rule-engine-associated-feature-test --filter FIND_NOTHING --skip-nx-cache

 >  NX   --skip-nx-cache disables the connection to Nx Cloud for the current run.

   The remote cache will not be read from or written to during this run.


> nx run trends-api-rule-engine-associated-feature-test:test --filter FIND_NOTHING

Executing Command: dotnet "test" "C:\Users\Chris Leigh\Source\repos\nx-vigil\libs\trends\api\rule-engine\associated\feature-test\NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test.csproj" "--filter" "FIND_NOTHING" "--blame" "false" "--blame-crash" "false" "--blame-crash-collect-always" "false" "--blame-hang" "false"
  Determining projects to restore...
  All projects are up-to-date for restore.
  NxVigil.TrendsApi.Exceptions.PointOfSale.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\exceptions\point-of-sale\contracts\net8.0\NxVigil.TrendsApi.Exceptions.PointOfSale.Contracts.dll
  NxVigil.Core.Api.Validation.Util -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\core\api\validation\util\net8.0\NxVigil.Core.Api.Validation.Util.dll
  NxVigil.TrendsApi.RuleBuilder.Associated.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-builder\associated\contracts\net8.0\NxVigil.TrendsApi.RuleBuilder.Associated.Contracts.dll
  NxVigil.Trends.Api.Transactions.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\transactions\contracts\net8.0\NxVigil.Trends.Api.Transactions.Contracts.dll
  Checking module boundaries for trends-api-exceptions-point-of-sale-contracts
  CONFIGURED undefined
  Checking module boundaries for trends-api-rule-builder-associated-contracts
  CONFIGURED undefined
  Checking module boundaries for trends-api-transactions-contracts
  CONFIGURED undefined
  Checking module boundaries for core-api-validation-util
  CONFIGURED undefined
  loadModuleBoundaries: 2.375s
  check-module-boundaries: 2.424s
  loadModuleBoundaries: 2.324s
  check-module-boundaries: 2.376s
  loadModuleBoundaries: 2.350s
  check-module-boundaries: 2.401s
  loadModuleBoundaries: 2.375s
  check-module-boundaries: 2.432s
  NxVigil.TrendsApi.RuleEngine.Associated.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\associated\contracts\net8.0\NxVigil.TrendsApi.RuleEngine.Associated.Contracts.dll
  NxVigil.TrendsApi.RuleBuilder.PointOfSale.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-builder\point-of-sale\contracts\net8.0\NxVigil.TrendsApi.RuleBuilder.PointOfSale.Contracts.dll
  NxVigil.TrendsApi.RuleEngine.PointOfSale.Contracts -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\point-of-sale\contracts\net8.0\NxVigil.TrendsApi.RuleEngine.PointOfSale.Contracts.dll
  Checking module boundaries for trends-api-rule-builder-point-of-sale-contracts
  CONFIGURED undefined
  Checking module boundaries for trends-api-rule-engine-associated-contracts
  CONFIGURED undefined
  Checking module boundaries for trends-api-rule-engine-point-of-sale-contracts
  CONFIGURED undefined
  loadModuleBoundaries: 1.899s
  loadModuleBoundaries: 1.922s
  check-module-boundaries: 1.961s
  loadModuleBoundaries: 1.903s
  check-module-boundaries: 1.948s
  check-module-boundaries: 1.952s
  NxVigil.TrendsApi.RuleEngine.Associated.Feature -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\associated\feature\net8.0\NxVigil.TrendsApi.RuleEngine.Associated.Feature.dll
  Checking module boundaries for trends-api-rule-engine-associated-feature
  CONFIGURED undefined
  loadModuleBoundaries: 1.709s
  check-module-boundaries: 1.759s
  NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test -> C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\associated\feature-test\net8.0\NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test.dll
  Checking module boundaries for trends-api-rule-engine-associated-feature-test
  CONFIGURED undefined
  loadModuleBoundaries: 1.610s
  check-module-boundaries: 1.646s
  Purging TestResults: C:\Users\Chris Leigh\Source\repos\nx-vigil\libs\trends\api\rule-engine\associated\feature-test/TestResults/
Test run for C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\associated\feature-test\net8.0\NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Blame: Attaching crash dump utility to process testhost (38968).
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.5.4.1+b9eacec401 (64-bit .NET 8.0.3)
[xUnit.net 00:00:00.07]   Discovering: NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test
[xUnit.net 00:00:00.11]   Discovered:  NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test
[xUnit.net 00:00:00.11]   Starting:    NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test
[xUnit.net 00:00:00.13]   Finished:    NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test
No test matches the given testcase filter `FIND_NOTHING` in C:\Users\Chris Leigh\Source\repos\nx-vigil\dist\libs\trends\api\rule-engine\associated\feature-test\net8.0\NxVigil.TrendsApi.RuleEngine.Associated.Feature.Test.dll
Data collector 'Blame' message: All tests finished running, Sequence file will not be generated.
Data collector 'Blame' message: System.IO.FileNotFoundException: Collect dump was enabled but no dump file was generated.
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcessDumpUtility.GetDumpFiles(Boolean warnOnNoDumpFiles, Boolean processCrashed) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs:line 84
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector.SessionEndedHandler(Object sender, SessionEndEventArgs args) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs:line 534.
Results File: C:\Users\Chris Leigh\Source\repos\nx-vigil\libs\trends\api\rule-engine\associated\feature-test\TestResults\TestResults.xml
Attachments:
  C:\Users\Chris Leigh\Source\repos\nx-vigil\libs\trends\api\rule-engine\associated\feature-test\TestResults\f742f05d-ec4e-4785-867a-643731525650\coverage.cobertura.xml
  C:\Users\Chris Leigh\Source\repos\nx-vigil\libs\trends\api\rule-engine\associated\feature-test\TestResults\f742f05d-ec4e-4785-867a-643731525650\coverage.opencover.xml

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target test for project trends-api-rule-engine-associated-feature-test (17s)

         With additional flags:
           --filter=FIND_NOTHING

Additional Information

No response

@Tungsten78 Tungsten78 added bug Something isn't working needs-triage This issue has yet to be looked over by a core team member labels Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member
Projects
None yet
Development

No branches or pull requests

1 participant