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

Prevent "not implemented" error being logged in jsdom and general repository maintenance #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

srmagura
Copy link

When importing is-emoji-supported in jsdom (Jest), the following is logged via console.error:

    Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
        at module.exports (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
        at HTMLCanvasElementImpl.getContext (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
        at HTMLCanvasElement.getContext (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
        at /Users/srmagura/Documents/oss/emoji-mart/node_modules/is-emoji-supported/src/is-emoji-supported.ts:47:44
        at Object.<anonymous> (/Users/srmagura/Documents/oss/emoji-mart/node_modules/is-emoji-supported/src/is-emoji-supported.ts:107:2)
        at Runtime._execModule (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jest-runtime/build/index.js:1691:24)
        at Runtime._loadModule (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jest-runtime/build/index.js:1222:12)
        at Runtime.requireModule (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jest-runtime/build/index.js:1046:12)
        at Runtime.requireModuleOrMock (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jest-runtime/build/index.js:1247:21)
        at Runtime.loadCjsAsEsm (/Users/srmagura/Documents/oss/emoji-mart/node_modules/jest-runtime/build/index.js:853:22) {
      type: 'not implemented'
    }

While this does not cause tests to fail, people may waste time trying to fix this error. In both of the repositories where I'm seeing this error, it's not possible to suppress the error via Jest module mocking. So it made the most sense to fix it here.

I set up Jest in the repository so I could write a test that asserts console.error is not called when importing is-emoji-supported.ts.

General repository maintenance changes:

  • Upgraded most devDependencies to the latest version.
  • The repository contained both yarn.lock and package-lock.json, which is confusing for developers who are new to the project. I removed yarn.lock since the README said to run tests using npm.

By the way

If you like these changes and need help maintaining this repository, feel free to add me as a contributor. Just saying this because I cannot tell if this repository is abandoned, or if there has just been no recent work on it because there were no issues.

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

Successfully merging this pull request may close these issues.

None yet

1 participant