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 stopped working with version 2.3.0 #222

Open
LucaMele opened this issue Oct 22, 2019 · 5 comments
Open

JEST stopped working with version 2.3.0 #222

LucaMele opened this issue Oct 22, 2019 · 5 comments

Comments

@LucaMele
Copy link

LucaMele commented Oct 22, 2019

axa-ch-webhub-cloud/pattern-library#1452

axa-ch/jest-test-plib-v2#2

@AndyOGo
Copy link

AndyOGo commented Oct 22, 2019

Since 2.3.0 Jest throws TypeError: The custom element constructor's prototype is not an object.:

From my insights it seems that two different Object constructors are being used, which causes this check to fail.

try {
/** @type {!Object} */
const prototype = constructor.prototype;
if (!(prototype instanceof Object)) {
throw new TypeError('The custom element constructor\'s prototype is not an object.');
}

Reproduction Repo with relevant analysis in PR description:
axa-ch/jest-test-plib-v2#1

Lock down to 2.2.10 to mitigate this type error:
axa-ch/jest-test-plib-v2#2

@tomstumshais
Copy link

Hey! Any progress with this issue?

@peabnuts123
Copy link

If you are using @webcomponents/custom-elements lock down to version ^1.2.4

@elisiondan
Copy link

If you don't actually need the customElements to return an actual element and you're only aiming to avoid this error, you can can mock the implementation.

Create a config file for jest that will be included in all tests as part of a setupFiles option.

setup-globals.js
window.customElements = {
  define: () => {},
};
// jest.config.js
  ....
  setupFiles: [
    '<rootDir>/YOUR-PATH/setup-globals.js',
  ],

@stale
Copy link

stale bot commented Dec 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants