Skip to content

Commit e69d903

Browse files
authored
Mention jestjs/jest#2549 in the README (#1700)
1 parent d17f70f commit e69d903

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ Sass's support for the legacy JavaScript API has the following limitations:
142142
[`precision`]: https://github.com/sass/node-sass#precision
143143
[`sourceComments`]: https://github.com/sass/node-sass#sourcecomments
144144

145+
#### Using Sass with Jest
146+
147+
If you're using [Jest] to run your tests, be aware that it has a [longstanding
148+
bug] where its default test environment breaks JavaScript's built-in
149+
[`instanceof` operator]. Dart Sass's JS package uses `instanceof` fairly
150+
heavily, so in order to avoid breaking Sass you'll need to install
151+
[`jest-environment-node-single-context`] and add `testEnvironment:
152+
'jest-environment-node-single-context'` to your Jest config.
153+
154+
[Jest]: https://jestjs.io/
155+
[longstanding bug]: https://github.com/facebook/jest/issues/2549
156+
[`instanceof` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
157+
[`jest-environment-node-single-context`]: https://www.npmjs.com/package/jest-environment-node-single-context
158+
145159
### From Pub
146160

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

0 commit comments

Comments
 (0)