question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

E2E tests fails when creating a new nx-plugin workspace

See original GitHub issue

Current Behavior

When creating a new NX plugin workspace using npx create-nx-plugin my-plugin-workspace --pluginName my-plugin the E2E tests timeout.

Expected Behavior

The E2E tests should pass

Steps to Reproduce

  • npx create-nx-plugin@latest my-plugin-workspace --pluginName my-plugin
  • cd my-plugin-workspace
  • npm run e2e my-plugin-e2e

Failure Logs

 FAIL   my-plugin-e2e  e2e/my-plugin-e2e/tests/my-plugin.spec.ts (28.243 s)
  my-plugin e2e
    × should create my-plugin (25347 ms)
    --directory
      × should create src in the specified directory (29 ms)
    --tags
      × should add tags to nx.json (3 ms)

  ● my-plugin e2e › should create my-plugin

    : Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error:

       7 | } from '@nrwl/nx-plugin/testing';
       8 | describe('my-plugin e2e', () => {
    >  9 |   it('should create my-plugin', async (done) => {
         |   ^
      10 |     const plugin = uniq('my-plugin');
      11 |     ensureNxProject(
      12 |       '@my-plugin-workspace/my-plugin',

      at new Spec (../../node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Suite.<anonymous> (tests/my-plugin.spec.ts:9:3)
      at Object.<anonymous> (tests/my-plugin.spec.ts:8:1)

  ● my-plugin e2e › --directory › should create src in the specified directory

    EBUSY: resource busy or locked, rmdir 'C:\Development\Personal\my-plugin-workspace/tmp/nx-e2e/proj'

      at rmdirSync (../../node_modules/fs-extra/lib/remove/rimraf.js:276:13)
      at Object.rimrafSync (../../node_modules/fs-extra/lib/remove/rimraf.js:252:7)
      at Object.cleanup (../../packages/nx-plugin/src/utils/testing-utils/utils.ts:119:3)
      at newNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:67:3)
      at Object.ensureNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:82:3)
      at tests/my-plugin.spec.ts:28:7
      at ../../node_modules/tslib/tslib.js:114:75

  ● my-plugin e2e › --tags › should add tags to nx.json

    EBUSY: resource busy or locked, rmdir 'C:\Development\Personal\my-plugin-workspace/tmp/nx-e2e/proj'

      at rmdirSync (../../node_modules/fs-extra/lib/remove/rimraf.js:276:13)
      at Object.rimrafSync (../../node_modules/fs-extra/lib/remove/rimraf.js:252:7)
      at Object.cleanup (../../packages/nx-plugin/src/utils/testing-utils/utils.ts:119:3)
      at newNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:67:3)
      at Object.ensureNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:82:3)
      at tests/my-plugin.spec.ts:45:7
      at ../../node_modules/tslib/tslib.js:114:75

Test Suites: 1 failed, 1 total
Tests:       3 failed, 3 total
Snapshots:   0 total
Time:        29.911 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-plugin-workspace@0.0.0 e2e: `nx e2e "my-plugin-e2e"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-plugin-workspace@0.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\stefa\AppData\Roaming\npm-cache\_logs\2020-12-20T12_04_00_253Z-debug.log

Environment

  Node : 14.15.0
  OS   : win32 x64
  npm  : 6.14.8

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
BLaZeKiLLcommented, Dec 20, 2020

faced the same issue, as a work around I changed the timeout (in ms) value and the test passes

it('test', async(done) => {

}, 500000);
0reactions
Jameskmongercommented, Dec 23, 2022

This is still an issue for me, on Windows.

When I run the e2e (on a freshly generated plugin):

  ● pipenv e2e › --tags › should add tags to the project

    Command failed: node D:\Development\my_company\backend\node_modules\nx\bin\nx.js new proj --nx-workspace-root=D:\Development\my_company\backend/tmp/nx-e2e --no-interactive --skip-install --collection=@nrwl/workspace --npmScope=proj --preset=empty

      at runNxNewCommand (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:15:18)
      at newNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:72:3)
      at ensureNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:86:3)
      at tests/pipenv.spec.ts:48:22
      at ../../node_modules/tslib/tslib.js:118:75
      at Object.__awaiter (../../node_modules/tslib/tslib.js:114:16)

When I run that inner node command I get:

λ node D:/Development/my_company/backend/node_modules/nx/bin/nx.js new proj --nx-workspace-root=D:/Development/my_company/backend/tmp/nx-e2e --no-interactive --skip-install --collection=@nrwl/workspace --npmScope=proj --preset=empty

 >  NX   D:\Development\my_company\backend\tmp\nx-e2e\proj is not an empty directory.

   Pass --verbose to see the stacktrace.
Read more comments on GitHub >

github_iconTop Results From Across the Web

E2E tests are not running on Jenkins job - Stack Overflow
I have a Maven project written in Java where I created a suite of E2E (End To End) tests realised using Selenium.
Read more >
Unit test reports - GitLab Docs
If the tests fail, the pipeline fails and users get notified. The person that works on the merge request has to check the...
Read more >
Troubleshooting - Jest
Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​. Try using the debugging support built into...
Read more >
Language Server Extension Guide - Visual Studio Code
Explain how to run, debug, log, and test the Language Server extension. ... To follow the walkthrough, you can create a new server.ts...
Read more >
cypress-fail-fast - npm
If you want to configure the plugin on a specific test, you can set this by using the failFast property in test configuration....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found