-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
gatsby-node.js
37 lines (31 loc) · 968 Bytes
/
gatsby-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
describe(`gatsby-plugin-react-css-modules`, () => {
const { modifyBabelrc } = require(`../gatsby-node`)
const babelrc = {
presets: [`great`, `scott`],
plugins: [`fitzgerald`],
}
it(`adds react-css-modules to babelrc`, () => {
const modified = modifyBabelrc({ babelrc }, {})
expect(modified).toMatchObject({
presets: [`great`, `scott`],
plugins: [`fitzgerald`, [`react-css-modules`, expect.any(Object)]],
})
})
it(`includes custom options when modifying babelrc`, () => {
const options = {
exclude: `/global/`,
filetypes: {
".scss": { syntax: `postcss-scss` },
},
generateScopedName: `[name]---[local]---[hash:base64]`,
}
const modified = modifyBabelrc({ babelrc }, options)
expect(modified).toMatchObject({
presets: [`great`, `scott`],
plugins: [
`fitzgerald`,
[`react-css-modules`, expect.objectContaining(options)],
],
})
})
})