1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-01 12:29:49 +01:00

TypeScript & Jest setup cleanup

This commit is contained in:
Matthias Kretschmann 2020-05-08 14:10:36 +02:00
parent 0576e4f662
commit 24e0b2e8f9
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 2788 additions and 1797 deletions

3
babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: ['babel-preset-gatsby', '@babel/preset-typescript']
}

View File

@ -231,7 +231,6 @@ module.exports = {
'gatsby-redirect-from', 'gatsby-redirect-from',
'gatsby-plugin-meta-redirect', 'gatsby-plugin-meta-redirect',
'gatsby-plugin-offline', 'gatsby-plugin-offline',
'gatsby-plugin-typescript',
'gatsby-plugin-webpack-size' 'gatsby-plugin-webpack-size'
// { // {
// resolve: 'gatsby-plugin-webpack-bundle-analyser-v2', // resolve: 'gatsby-plugin-webpack-bundle-analyser-v2',

View File

@ -1,16 +1,10 @@
module.exports = { module.exports = {
transform: {
'^.+\\.(tsx?|jsx?)$': 'ts-jest',
'^.+\\.jsx?$': '<rootDir>/jest/jest-preprocess.js'
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.([tj]sx?)$',
moduleNameMapper: { moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy', '.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/jest/__mocks__/file-mock.js', '<rootDir>/jest/__mocks__/file-mock.js',
'\\.svg': '<rootDir>/jest/__mocks__/svgr-mock.js' '\\.svg': '<rootDir>/jest/__mocks__/svgr-mock.js'
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testPathIgnorePatterns: ['node_modules', '.cache', 'public', 'coverage'], testPathIgnorePatterns: ['node_modules', '.cache', 'public', 'coverage'],
transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'], transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'],
globals: { globals: {

View File

@ -1,7 +0,0 @@
const { createTransformer } = require('babel-jest')
const babelOptions = {
presets: ['babel-preset-gatsby', '@babel/preset-typescript']
}
module.exports = createTransformer(babelOptions)

4548
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,6 @@
"gatsby-plugin-sharp": "^2.6.2", "gatsby-plugin-sharp": "^2.6.2",
"gatsby-plugin-sitemap": "^2.4.2", "gatsby-plugin-sitemap": "^2.4.2",
"gatsby-plugin-svgr": "^2.0.2", "gatsby-plugin-svgr": "^2.0.2",
"gatsby-plugin-typescript": "^2.4.2",
"gatsby-plugin-use-dark-mode": "^1.1.2", "gatsby-plugin-use-dark-mode": "^1.1.2",
"gatsby-plugin-webpack-size": "^1.0.0", "gatsby-plugin-webpack-size": "^1.0.0",
"gatsby-redirect-from": "^0.2.1", "gatsby-redirect-from": "^0.2.1",
@ -91,7 +90,6 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/node": "^7.8.7", "@babel/node": "^7.8.7",
"@babel/preset-env": "^7.9.6",
"@babel/preset-typescript": "^7.9.0", "@babel/preset-typescript": "^7.9.0",
"@svgr/webpack": "^5.4.0", "@svgr/webpack": "^5.4.0",
"@testing-library/jest-dom": "^5.6.0", "@testing-library/jest-dom": "^5.6.0",
@ -111,7 +109,6 @@
"@typescript-eslint/parser": "^2.31.0", "@typescript-eslint/parser": "^2.31.0",
"@welldone-software/why-did-you-render": "^4.2.0", "@welldone-software/why-did-you-render": "^4.2.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-jest": "^25.5.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
"eslint-loader": "^4.0.2", "eslint-loader": "^4.0.2",
@ -123,7 +120,7 @@
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.9", "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.9",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^25.5.4", "jest": "^26.0.1",
"markdownlint-cli": "^0.23.0", "markdownlint-cli": "^0.23.0",
"node-iptc": "^1.0.5", "node-iptc": "^1.0.5",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
@ -136,7 +133,6 @@
"stylelint-config-prettier": "^8.0.1", "stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-prettier": "^1.1.2", "stylelint-prettier": "^1.1.2",
"ts-jest": "^25.5.0",
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"repository": { "repository": {