bit icon indicating copy to clipboard operation
bit copied to clipboard

"ReferenceError: FontFace is not defined" during test runs

Open zach-thrivetribe opened this issue 3 years ago • 1 comments

Describe the bug

Running bit test throws a ReferenceError: FontFace is not defined error when testing a component that uses the CSS Font Loading API.

Steps to Reproduce

  1. run bit test on a component that uses the font loading API

Expected Behavior

Successful run of the unit tests

Screenshots, exceptions and logs

` ReferenceError: FontFace is not defined

  1 | export const loadBebasNeueFont = () => {
> 2 |   var bebasNeue = new FontFace("Bebas Neue", "url(https://fonts.gstatic.com/s/bebasneue/v8/JTUSjIg69CK48gW7PXoo9Wlhyw.woff2)", {weight: "400"});
    |                   ^
  3 |
  4 |   bebasNeue
  5 |     .load()`### Specifications* Bit version: 0.0.603
  • Workspace type: harmony
  • Node version: 14.17.3
  • npm / yarn version: 6.14.13
  • Platform: windows 10
"teambit.dependencies/dependency-resolver": {
    /**
     * choose the package manager for Bit to use. you can choose between 'yarn', 'pnpm'
     */
    "packageManager": "teambit.dependencies/pnpm",
    "policy": {
      "dependencies": {
        "@testing-library/dom": "8.11.3",
        "@testing-library/react": "12.1.3",
        "@testing-library/user-event": "13.5.0",

zach-thrivetribe avatar Mar 14 '22 15:03 zach-thrivetribe

Forgot to mention that the Font Loading API works perfectly fine outside of the tests, I am able to tag and export components that use it just fine, but when put in the tests it throws those errors.

zach-thrivetribe avatar Mar 15 '22 09:03 zach-thrivetribe

resolved in new envs api

NitsanCohen770 avatar Aug 28 '23 22:08 NitsanCohen770