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.

Automated tests are broken: src/emdedWebFonts.ts

See original GitHub issue

It seems like the tests are broken after forking master and running yarn test

Expected Behavior

Test to pass.

Current Behavior

Tests fail immediately.

Possible Solution

if ('cssRules' in sheet) {
      try {
        toArray<CSSRule>(sheet.hasOwnProperty('cssRules')).forEach(

Looks like the code assumes hasOwnProperty returns the sheet.cssRules instead it returns a boolean (true/false). The check just needs to be done separately.

Steps To Reproduce

yarn test

Error Message & Stack Trace

yarn run v1.22.17
$ rimraf ./test/coverage
$ karma start
25 03 2022 12:45:46.762:INFO [compiler.karma-typescript]: Compiling project using Typescript 4.4.3
25 03 2022 12:45:50.348:ERROR [compiler.karma-typescript]: src/embedWebFonts.ts(144,62): error TS2339: Property 'length' does not exist on type 'boolean'.

25 03 2022 12:45:50.348:ERROR [compiler.karma-typescript]: src/embedWebFonts.ts(173,76): error TS2339: Property 'length' does not exist on type 'boolean'.

error Command failed with exit code 1.

Additional Context

N/A

Your Environment

  • html-to-image: master
  • OS: macOS Monteray, zsh
  • Browser: N/A

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
insanityfarmcommented, Jul 7, 2022

@bubkoo Are you still maintaining this project? I am very curious why you have not pulled in the fix for the build, which has been broken since December.

1reaction
socram8888commented, Jun 5, 2022

Tests have been fixed in our fork at https://github.com/RigoCorp/html-to-image/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automated testing is not working - LogRocket Blog
Automated regression tests sound great in theory, and anybody starting a new job could not fail to be impressed when finding out that...
Read more >
The dos and don'ts of testing automation - TechBeacon
Developing automated tests is a software development effort itself. ... tests to make sure that a code change in one feature hasn't broken...
Read more >
When is a Test Case Ready for Test Automation?
This is by far the most common cause of breaking automated tests, and one which mitigating is very difficult. This is one of...
Read more >
Unit Testing Best Practices: 9 to Ensure You Do It Right
There are many types of automated testing out there: front-end testing, ... their recent modifications to the code haven't broken anything.
Read more >
Everything There Is To Know About Automated Testing
How is test automation changing the world? Limitations of automated testing; Benefits of automated testing; 3 levels of the testing process; What tests...
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