-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly set up IntersectionObserver mocking
For some reason, upstream react-intersection-observer switched from `beforeEach` to `beforeAll` in v9.12.0: - https://github.com/thebuilder/react-intersection-observer/pull/690/files#diff-26d4dc52e61d263a4256bed7c9ae3a9044b18a52f96f4f6840ca46336fb9216fL23-L24 - https://github.com/thebuilder/react-intersection-observer/releases/tag/v9.12.0 This led to errors on our side: Error: Uncaught [TypeError: observer.observe is not a function] I'm not entirely sure what the reason is (it looks like the mock gets unset every test?), but this restores it to its previous behaviour, and in a way that doesn't look particularly likely for upstream to break, so I think that's fine for now. Initially I also set https://www.typescriptlang.org/docs/handbook/modules/reference.html#bundler to import from `react-intersection-observer/test-utils`, but that caused issues elsewhere (in particular when importing from `@mozilla/glean/web`), so I reverted that since our tests aren't type-checked anyway. I did make a couple of adjustments elsewhere to be compatible with both that setting and the previous value.
- Loading branch information
Showing
4 changed files
with
18 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters