Skip to content

Commit

Permalink
update webpack, jest, yarn configs
Browse files Browse the repository at this point in the history
update gitignore

remove coverage files

revert mock changes
  • Loading branch information
larrycustodio committed Mar 26, 2021
1 parent 4ce53bc commit 437f17d
Show file tree
Hide file tree
Showing 11 changed files with 5,246 additions and 4,867 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ dist/
node_modules/
coverage/
src/**/*.jsx
tests/__coverage__/
__mocks__/
tests/**/*.jsx
.DS_Store
32 changes: 32 additions & 0 deletions configs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { defaults: tsjPreset } = require('ts-jest/presets')

module.exports = {
"rootDir": "..",
"coverageDirectory": "<rootDir>/__mocks__/__coverage__/",
"clearMocks": true,
"setupFiles": [
"<rootDir>/__mocks__/shim.js"
],
setupFilesAfterEnv: ['jest-enzyme'],
testEnvironment: 'enzyme',
"moduleNameMapper": {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less|scss)$': '<rootDir>/__mocks__/styleMock.js',
},
"moduleFileExtensions": ["ts", "tsx", "js", "jsx"],
"transform": {
...tsjPreset.transform,
},
"transformIgnorePatterns": [
"/node_modules/"
],
"testRegex": ".*\.test\.(ts|tsx)$",
"moduleDirectories": [
"node_modules"
],
"globals": {
"DEVELOPMENT": false,
"FAKE_SERVER": false
}
}
30 changes: 0 additions & 30 deletions configs/jest.json

This file was deleted.

22 changes: 0 additions & 22 deletions configs/jest.preprocessor.js

This file was deleted.

3 changes: 3 additions & 0 deletions configs/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'react-dom': '@hot-loader/react-dom'
}
},
context: resolve(__dirname, '../../src'),
module: {
Expand Down
1 change: 0 additions & 1 deletion configs/webpack/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const commonConfig = require('./common')
module.exports = merge(commonConfig, {
mode: 'development',
entry: [
'react-hot-loader/patch', // activate HMR for React
'webpack-dev-server/client?http://localhost:8080', // bundle the client for webpack-dev-server and connect to the provided endpoint
'webpack/hot/only-dev-server', // bundle the client for hot reloading, only- means to only hot reload for successful updates
'./index.tsx', // the entry point of our app
Expand Down
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "tslint './src/**/*.ts*' --format stylish --project . --force",
"start": "yarn run start-dev",
"start-dev": "webpack-dev-server --config=configs/webpack/dev.js",
"test": "jest --watch --coverage --config=jest.config.js"
"test": "jest --watch --coverage --config=configs/jest.config.js"
},
"devDependencies": {
"@babel/cli": "^7.6.4",
Expand All @@ -31,7 +31,7 @@
"file-loader": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^6.0.0",
"jest": "^24.9.0",
"jest": "^26.6.3",
"jest-environment-enzyme": "^7.1.1",
"jest-enzyme": "^7.1.1",
"node-sass": "^4.13.1",
Expand All @@ -41,7 +41,8 @@
"sass-loader": "^8.0.0",
"source-map-loader": "^0.2.4",
"style-loader": "^1.0.0",
"ts-jest": "^24.1.0",
"terser-webpack-plugin": "^5.1.1",
"ts-jest": "^26.5.4",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"uglifyjs-webpack-plugin": "^2.2.0",
Expand All @@ -54,6 +55,7 @@
"dependencies": {
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22",
"@hot-loader/react-dom": "16.10.2",
"react-hot-loader": "^4.12.15",
"react-redux": "^7.1.1",
"redux": "^4.0.4"
Expand Down
3 changes: 1 addition & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { FC } from 'react'
import { hot } from 'react-hot-loader/root'
import styled from '@emotion/styled'
import Header from './Header'

Expand All @@ -19,4 +18,4 @@ const Container = styled.div({
paddingTop: '60px',
})

export default hot(App)
export default App
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<noscript>For the best experience, please enable JavaScript</noscript>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.10.2/umd/react.development.js" integrity="sha256-Fy0+oh76u+dih9imNzr0Ka1RHbVKV8o4nR+p8s6wTXE=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.10.2/umd/react-dom.development.js" integrity="sha256-ZMB3rvxm3yr+lN12NcNAJbw6JQWFah3Qx3s3XH1Z0P8=" crossorigin="anonymous"></script>
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
</body>
</html>
Loading

0 comments on commit 437f17d

Please sign in to comment.