mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-11-04 02:29:46 +01:00 
			
		
		
		
	Upgrade to Gatsby v2
This commit is contained in:
		
							
								
								
									
										3
									
								
								tests/__mocks__/fileMock.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								tests/__mocks__/fileMock.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
module.exports = 'file';
 | 
			
		||||
							
								
								
									
										10
									
								
								tests/__mocks__/gatsby.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/__mocks__/gatsby.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										21
									
								
								tests/jest-config.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										11
									
								
								tests/jest-preprocess.js
									
									
									
									
									
										Normal 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);
 | 
			
		||||
		Reference in New Issue
	
	Block a user