Code Monkey home page Code Monkey logo

jest-environment-happy-dom's People

Contributors

capricorn86 avatar davidortnercybercom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jest-environment-happy-dom's Issues

Cannot set property console?

image

package.json

"jest": "^24.9.0",
"jest-environment-happy-dom": "0.0.36"

"jest": {
    "testPathIgnorePatterns": [
      "src"
    ],
    "testEnvironment": "jest-environment-happy-dom"
  }

Errors after document.createElement inside test file.

Hello!

First of all, thank you for the work and effort in creating happy dom & happy dom jest environment - it's nice to see community support for LitElement environment :)

I have been trying to make a simple proof of concept test to mess with the library/environment and check how it works, but I'm not able to create my custom element inside test - I always got an error running them regarding TypeError: Cannot read property 'forEach' of undefined.

    const element = document.createElement('sample-component');
    const myContainer = document.querySelector('body');
    myContainer.appendChild(element);

This is the stack trace:

      126 | /**
      127 |  * @license
      128 |  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.

      at t.forEach [as **_saveInstanceProperties**] (dist/main.js:125:4431)
      at t._saveInstanceProperties (dist/main.js:125:4323)
      at t.initialize (dist/main.js:139:581)
      at t.initialize (dist/main.js:125:2584)
      at t.ye (dist/main.js:3:2239)
      at new call (dist/main.js:139:2704)
      at createElement (__tests__/sample-component.test.js:14:30)

I have also needed to polyfill window.requestAnimationFrame and window.performance, otherwise I couldn't even run the tests but seems strange for me - it's necessary?

I have confirmed my bundled build works as expected after testing standalone on browser (it's just a simple custom element definition).

Inside the test spec file, I have also another test checking if the custom element has been defined, and it works as expected, so it sounds strange for me :/ Do it sounds familiar to you???

Thanks for all!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.