Skip to content

Commit

Permalink
feat(assets): add unit test tool for assets compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck DIOMANDE committed Dec 4, 2019
1 parent fdffc02 commit f00d1b8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/assets/assets.config.json
Expand Up @@ -19,7 +19,7 @@
},
"events": {
"after_add": {
"rm": ["webpack", "app.js", "entry.js", "package.json"]
"rm": ["webpack", "app.js", "babel.config.js", "entry.js", "jest.config.js" ,"package.json"]
},
"after_update": {
"exec": [
Expand All @@ -34,7 +34,9 @@
"cache_cp": [
{"entry": "webpack", "output": "{{ assets_directory }}/webpack"},
{"entry": "app.js", "output": "{{ assets_directory }}/app.js"},
{"entry": "babel.config.js", "output": "{{ assets_directory }}/app.js"},
{"entry": "entry.js", "output": "{{ assets_directory }}/entry.js"},
{"entry": "jest.config.js", "output": "{{ assets_directory }}/entry.js"},
{"entry": "package.json", "output": "{{ assets_directory }}/package.json"}
]
}
Expand Down
3 changes: 3 additions & 0 deletions src/assets/babel.config.js
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
};
30 changes: 30 additions & 0 deletions src/assets/jest.config.js
@@ -0,0 +1,30 @@
// https://jestjs.io/docs/en/configuration.html

module.exports = {

// Automatically clear mock calls and instances between every test
clearMocks: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['**/?(*.)+.js?(x)'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',

// An array of file extensions your modules use
moduleFileExtensions: ['js', 'jsx'],

// The glob patterns Jest uses to detect test files
// testMatch: ['components/*/*.spec.jsx'],
testMatch: ['**/?(*.)+(spec|test).js?(x)'],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['<rootDir>/node_modules/'],

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: ['<rootDir>/node_modules/'],

// Indicates whether each individual test should be reported during the run
verbose: true,

};
21 changes: 13 additions & 8 deletions src/assets/package.json
Expand Up @@ -3,31 +3,36 @@
"version": "1.0.0",
"description": "Assets module",
"scripts": {
"compile": "./node_modules/.bin/webpack --mode=development --config=webpack/webpack.config.dev.js",
"build": "./node_modules/.bin/webpack --mode=production --config=webpack/webpack.config.prod.js",
"watch": "./node_modules/.bin/webpack --mode=development --config=webpack/webpack.config.dev.js --watch"
"compile": "webpack --mode=development --config=webpack/webpack.config.dev.js",
"build": "webpack --mode=production --config=webpack/webpack.config.prod.js",
"watch": "webpack --mode=development --config=webpack/webpack.config.dev.js --watch",
"test": "jest --passWithNoTests"
},
"keywords": [],
"author": "Skyflow - Franck",
"license": "Apache-2.0",
"dependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4",
"babel-polyfill": "^6.26.0",
"immutable": "^4.0.0-rc.12",
"lodash": "^4.17.15",
"react": "^16.9.0",
"react-dom": "^16.9.0"
},
"devDependencies": {
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/preset-react": "^7.7.4",
"@testing-library/react": "^9.3.2",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-polyfill": "^6.26.0",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^1.0.0",
"file-loader": "^2.0.0",
"jest": "^24.9.0",
"mini-css-extract-plugin": "^0.4.3",
"node-sass": "^4.9.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"react-test-renderer": "^16.12.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"uglifyjs-webpack-plugin": "^2.0.1",
Expand Down

0 comments on commit f00d1b8

Please sign in to comment.