Skip to content

Commit

Permalink
setup IntersectionObserver config for jest
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi-sl committed Aug 23, 2024
1 parent 87d1132 commit c3e45ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions config/jest/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
global.IntersectionObserver = class IntersectionObserver {
disconnect() {
return null;
}

observe() {
return null;
}

takeRecords() {
return null;
}

unobserve() {
return null;
}
};
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
roots: [
'<rootDir>/tests',
],
setupFiles: ['<rootDir>/config/jest/jest.setup.js'],
setupFilesAfterEnv: [
'<rootDir>/config/setupTests.js',
],
Expand Down

0 comments on commit c3e45ab

Please sign in to comment.