mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-25 14:29:36 +01:00
chore: update mocks, move configs to jest dir
This commit is contained in:
parent
42d6377fde
commit
32351b33c2
29
jest/__mocks__/gatsby.js
Normal file
29
jest/__mocks__/gatsby.js
Normal file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
const gatsby = jest.requireActual('gatsby');
|
||||
|
||||
module.exports = {
|
||||
...gatsby,
|
||||
graphql: jest.fn(),
|
||||
Link: jest.fn().mockImplementation(
|
||||
({
|
||||
activeClassName,
|
||||
activeStyle,
|
||||
getProps,
|
||||
innerRef,
|
||||
ref,
|
||||
replace,
|
||||
to,
|
||||
...rest
|
||||
}) => (
|
||||
React.createElement('a', {
|
||||
...rest,
|
||||
href: to,
|
||||
})
|
||||
)
|
||||
),
|
||||
StaticQuery: jest.fn(),
|
||||
useStaticQuery: jest.fn(),
|
||||
};
|
@ -17,5 +17,6 @@ module.exports = {
|
||||
globals: {
|
||||
__PATH_PREFIX__: ''
|
||||
},
|
||||
testURL: 'http://localhost/'
|
||||
testURL: 'http://localhost/',
|
||||
setupFiles: ['<rootDir>/tests/loadershim.js']
|
||||
};
|
@ -1,7 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const babelOptions = {
|
||||
presets: ['@babel/react', '@babel/env'],
|
||||
presets: [
|
||||
'@babel/react',
|
||||
'@babel/env',
|
||||
'babel-preset-gatsby'
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-optional-chaining',
|
||||
'@babel/plugin-proposal-class-properties',
|
5
jest/loadershim.js
Normal file
5
jest/loadershim.js
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
global.___loader = {
|
||||
enqueue: jest.fn(),
|
||||
};
|
@ -12,9 +12,9 @@
|
||||
"lint:js": "eslint --cache --ext .js,.jsx --ignore-pattern public .",
|
||||
"lint:scss": "stylelint \"src/**/*.scss\"",
|
||||
"lint": "concurrently \"yarn run lint:js\" \"yarn run lint:scss\" \"yarn flow\"",
|
||||
"test": "jest --config ./tests/jest-config.js",
|
||||
"test:coverage": "jest --coverage --config ./tests/jest-config.js",
|
||||
"test:watch": "jest --watch --config ./tests/jest-config.js",
|
||||
"test": "jest --config ./jest/jest-config.js",
|
||||
"test:coverage": "jest --coverage --config ./jest/jest-config.js",
|
||||
"test:watch": "jest --watch --config ./jest/jest-config.js",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"repository": "https://github.com/alxshelepenok/gatsby-starter-lumen",
|
||||
@ -87,6 +87,7 @@
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
|
||||
"@babel/preset-env": "7.4.4",
|
||||
"@babel/preset-react": "7.0.0",
|
||||
"babel-preset-gatsby": "0.1.11",
|
||||
"autoprefixer": "9.5.1",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "10.0.1",
|
||||
|
@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const gatsby = jest.requireActual('gatsby');
|
||||
|
||||
module.exports = {
|
||||
...gatsby,
|
||||
graphql: jest.fn(),
|
||||
Link: 'Link',
|
||||
StaticQuery: 'StaticQuery'
|
||||
};
|
Loading…
Reference in New Issue
Block a user