Comments (10)
Hi there 👋 - so this is a bit more complex than one may imagine. Most typically getting this error during a unit test is a result of a test doing something that is causing the project graph to be created. You'll need to mock the project graph during these tests, and while that sounds rough its also going to give you much more accurate and repeatable tests.
Without mocking the graph, the tests will be running generators which create the project graph of the current Nx workspace and make some decisions about that. That's almost always not really what you want. We just recently fixed that behavior on the Nx repo.
This suddenly became a problem for some folks because several of our published generators do rely on the graph now.
You can see how we are mocking this in our unit test setup: https://github.com/nrwl/nx/blob/master/scripts/unit-test-setup.js
from nx.
Having the same issue. Tests run well on local Mac, but does not work on Linux env in CI.
from nx.
experiencing the same but with the applicationGenerator from '@nx/next' on v18.3.4
from nx.
I'm experiencing the same problem. Tests work on MacOS but not on our Linux CI.
It happens when I call the libraryGenerator
function from @nx/nest
@18.3.4 on a Jest test
from nx.
I have a similar issue with a Jest test also using the libraryGenerator
. However, I see the error on both Github Actions / nx agents as well as on my Mac developer machine.
I also tried to copy paste the test in this issue and run the test, and it fails on my mac running Sonoma 14.4.1
from nx.
I got my test to run by following a workaround from mswjs/msw#1851
Object.defineProperties(globalThis, {
performance: { value: performance, writable: true },
});
Not quite sure why it works, but my test runs again with this 'fix'.
from nx.
I'm having the same issue when wrapping the service schematic from @schematics/angular, and executing that.
Although, when running locally (MacOS) I get this error
ReferenceError: TextDecoder is not defined
18 |
19 | const serviceGenerator = wrapAngularDevkitSchematic('@schematics/angular', 'service');
> 20 | await serviceGenerator(tree, serviceOptions);
| ^
21 |
at Object.<anonymous> (../../node_modules/@angular-devkit/schematics/src/rules/template.js:33:17)
at Object.<anonymous> (../../node_modules/@angular-devkit/schematics/src/index.js:56:14)
at Object.<anonymous> (../../node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:16:15)
at Object.<anonymous> (../../node_modules/@angular-devkit/schematics/tools/index.js:27:14)
at createWorkflow (../../node_modules/nx/src/adapter/ngcli-adapter.js:165:26)
at ../../node_modules/nx/src/adapter/ngcli-adapter.js:697:26
at serviceGenerator (src/generators/service/generator.ts:20:3)
at Object.<anonymous> (src/generators/service/generator.spec.ts:34:5)
but on CI I get the same as OP.
from nx.
facing the same issue, but only in the TeamCity environment.
from nx.
@AgentEnder , any update on this?
from nx.
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.
from nx.
Related Issues (20)
- TypeError: isAssetFile is not a function in react-native 0.73.6 version ( nx version 19.0.0) HOT 3
- Bug: Cannot find module 'storybook/internal/common' in v19.6.2 HOT 2
- ENOENT: no such file or directory server-process.json
- EPERM: operation not permitted, open daemon.log
- @nx/vite:build doesn't set NODE_ENV properly
- Playwright project generated with Remix use the wrong start command
- New express workspace has failing e2e tests HOT 1
- @typescript-eslint/parser peer dependency is not updated HOT 1
- Migration to 19.6.2 - Storybook 8 fails
- [Windows] Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it. HOT 5
- Nx Cypress E2E cannot resolve @nx/js library for neither shared commands nor utils.
- nx release - No git tags matching pattern with releaseTagPattern @XXXX/{projectName}/v{version}
- Missing Platform Dependency - v19.4.4 - darwin-x64
- @nx/js:tsc build fails on Windows with Yarn PnP after 19.6.1
- Cypress fails to close
- nx 19.6.3 cannot generate plugins TypeError: Cannot read properties of undefined (reading 'length') HOT 4
- Error "Could not execute command because the task graph has a circular dependency" after upgrading from 19.3.1 to 19.6.3
- Nx graph --print doesn't print anymore
- Error after generating react library in react-standalone example HOT 1
- NX 18 not detecting node 18 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx.