Skip to content

Commit

Permalink
Mention jestjs/jest#2549 in the README (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 23, 2022
1 parent d17f70f commit e69d903
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -142,6 +142,20 @@ Sass's support for the legacy JavaScript API has the following limitations:
[`precision`]: https://github.com/sass/node-sass#precision
[`sourceComments`]: https://github.com/sass/node-sass#sourcecomments

#### Using Sass with Jest

If you're using [Jest] to run your tests, be aware that it has a [longstanding
bug] where its default test environment breaks JavaScript's built-in
[`instanceof` operator]. Dart Sass's JS package uses `instanceof` fairly
heavily, so in order to avoid breaking Sass you'll need to install
[`jest-environment-node-single-context`] and add `testEnvironment:
'jest-environment-node-single-context'` to your Jest config.

[Jest]: https://jestjs.io/
[longstanding bug]: https://github.com/facebook/jest/issues/2549
[`instanceof` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
[`jest-environment-node-single-context`]: https://www.npmjs.com/package/jest-environment-node-single-context

### From Pub

If you're a Dart user, you can install Dart Sass globally using `pub global
Expand Down

0 comments on commit e69d903

Please sign in to comment.