Upgrade to Gatsby v2

This commit is contained in:
alxshelepenok
2018-11-09 20:08:48 +03:00
parent e83dfc6dff
commit 8b92891329
204 changed files with 18708 additions and 3904 deletions

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = 'file';

10
tests/__mocks__/gatsby.js Normal file
View File

@@ -0,0 +1,10 @@
'use strict';
const gatsby = jest.requireActual('gatsby');
module.exports = {
...gatsby,
graphql: jest.fn(),
Link: 'Link',
StaticQuery: 'StaticQuery'
};

21
tests/jest-config.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
module.exports = {
rootDir: '../',
transform: {
'^.+\\.js?$': '<rootDir>/tests/jest-preprocess.js'
},
testMatch: ['**/__tests__/**/*.js', '**/?(*.)test.js'],
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/tests/__mocks__/fileMock.js'
},
testPathIgnorePatterns: ['node_modules', '.cache', 'public'],
transformIgnorePatterns: [
'node_modules/(?!(gatsby)/)'
],
globals: {
__PATH_PREFIX__: ''
},
testURL: 'http://localhost/'
};

11
tests/jest-preprocess.js Normal file
View File

@@ -0,0 +1,11 @@
'use strict';
const babelOptions = {
presets: ['@babel/react', '@babel/env'],
plugins: [
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties'
],
};
module.exports = require('babel-jest').createTransformer(babelOptions);