This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add jest configuration * Downgrade jest, since higher version have breaking changes that do not work with our current testing setup * Remove module.exports and requires, when not needed * Remove babel/preset-env since it is no longer needed
- Loading branch information
1 parent
ddff6d5
commit a42fbe2
Showing
9 changed files
with
1,052 additions
and
1,211 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = require('babel-jest').createTransformer({ | ||
presets: ['babel-preset-gatsby', '@emotion/babel-preset-css-prop'], | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.js$': '<rootDir>/jest-preprocess.js', | ||
}, | ||
testPathIgnorePatterns: ['node_modules', '\\.cache/'], | ||
globals: { | ||
__PATH_PREFIX__: '', | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!(gatsby||gatsby-plugin-mdx)/)'], | ||
setupFiles: ['<rootDir>/loadershim.js'], | ||
setupFilesAfterEnv: ['<rootDir>/setup-test-env.js'], | ||
moduleNameMapper: { | ||
'^@reach/router(.*)': '<rootDir>/node_modules/@gatsbyjs/reach-router$1', | ||
'^gatsby-page-utils/(.*)$': `gatsby-page-utils/dist/$1`, | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
global.___loader = { | ||
enqueue: jest.fn(), | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* global expect */ | ||
import { createSerializer, matchers } from '@emotion/jest'; | ||
import * as emotion from '@emotion/react'; | ||
import '@testing-library/jest-dom'; | ||
|
||
expect.extend(matchers); | ||
expect.addSnapshotSerializer(createSerializer(emotion)); | ||
|
||
global.ResizeObserver = class ResizeObserver { | ||
observe = jest.fn(); | ||
disconnect = jest.fn(); | ||
}; |
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
Oops, something went wrong.