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

Jest test suite fails to run #822

Closed
jholland918 opened this issue Feb 10, 2018 · 12 comments · Fixed by #825
Closed

Jest test suite fails to run #822

jholland918 opened this issue Feb 10, 2018 · 12 comments · Fixed by #825
Labels

Comments

@jholland918
Copy link
Contributor

jholland918 commented Feb 10, 2018

I'm submitting a bug report

  • Library Version:
    0.32.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    8.9.4

  • NPM Version:
    5.5.1
  • Browser:
    Chrome 64.0.3282.140 (Official Build) (64-bit)

  • Language:
    all

  • Loader/bundler:
    Webpack

Current behavior:
Running au jest fails to run the pre-configured test and prints this output

...\au-webpack-babel-jest> au jest
 FAIL  test\unit\app.spec.js
  ● Test suite failed to run

    TypeError: Cannot read property 'Node' of undefined

      at patchNotifyChange (node_modules/aurelia-pal-nodejs/dist/nodejs-pal-builder.js:55:35)
      at Object.<anonymous> (test/jest-pretest.js:6:33)

Test Suites: 1 failed, 1 total
  • What is the expected behavior?
    Steps to reproduce

Run au new

Project Configuration
    Name: au-webpack-babel-jest
    Platform: Web
    Bundler: Webpack
    Loader: None
    Transpiler: Babel
    Markup Processor: None
    CSS Processor: None
    Unit Test Runner: Jest
    Integration Test Runner: None
    Editor: Visual Studio Code

Would you like to create this project?
[Yes]

Would you like to install the project dependencies?
[Yes]

Run au jest

  • What is the motivation / use case for changing the behavior?
    So newly created projects using Jest work out of the box.
@Alexander-Taran
Copy link
Contributor

Alexander-Taran commented Feb 10, 2018

It has been fixed in
"aurelia-pal-nodejs": "1.0.0-beta.3.0.0",
you got to update the dependency manually for now.
I cant find the issue at the moment but I stumbled upon the same behavior and found it somewhere around here.
So there you have it (-:

@jholland918
Copy link
Contributor Author

Updating aurelia-pal-nodejs to 1.0.0-beta.3.0.0 worked, thanks for the help!

I still see we have version 1.0.0-beta.2.0.0 in /lib/dependencies.json. I wonder if there's a reason for not bumping the version or if it's just an oversight.

@BBosman
Copy link
Contributor

BBosman commented Mar 5, 2018

I'm seeing this issue again, but on [email protected].

@Alexander-Taran
Copy link
Contributor

Alexander-Taran commented Mar 5, 2018

That'd make me responsible
Only thing changed between 3.0.0 and 3.1.0 was addition of NodeList
Which was aimed at allowing waitFor under Jest

aurelia/pal-nodejs@394da3e...6b21d12

Still the same repro?
au new -> au jest?

@BBosman
Copy link
Contributor

BBosman commented Mar 5, 2018

Yes, same repro.

Thanks for looking into it!

@Alexander-Taran
Copy link
Contributor

seems like you created project anew and did not update pal-nodejs
au new..
your steps..
updated pal-nodejs and everything worked.

note: cli was not released with the updates

also, probably need another bump of pal-nodejs dependency in produced configs.

@BBosman
Copy link
Contributor

BBosman commented Mar 5, 2018

That does solve it in my test repo, but not in my actual (private) repo. So now I need to figure out what's different between those two.

@JeroenVinke
Copy link
Collaborator

Try to remove the package-lock.json before installing the update

@Alexander-Taran
Copy link
Contributor

Alexander-Taran commented Mar 5, 2018

yeah.. and get rid of npm as well (-:
yarn add ftw..

biased opinion

@Alexander-Taran
Copy link
Contributor

@vermilion what's your use case not covered by yarn?

@martynchamberlin
Copy link

martynchamberlin commented Apr 17, 2018

This issue was originally created because of this JSDOM change per what domenic said:

We no longer store _core on Window after #2098.

You can see _core being referenced in aurelia-pal-nodejs here still, however. So it looks like the fix was to ensure that the JSDOM dependency doesn't progress past 11.5.1.

The problem is that in my project, I was trying to utilize aurelia-pal-nodejs but I was also specifying the latest version of JSDOM for use elsewhere, and that latest version was the instance that got used in the aurelia-pal-nodejs dependency, and thereby caused the error in this issue (#822) to resurface.

Hopefully this fix is temporary and the plan is to update the version of jsdom in aurelia-pal-nodejs to the latest version and no longer reference _core?

For now, my workaround fix is to just keep my package.json's version of jsdom capped at 11.5.1.

@JeroenVinke
Copy link
Collaborator

@martynchamberlin thanks for looking into this. Please open an issue in the aurelia-pal-nodejs repo so it can be looked into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants