mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 06:29:31 -02:30
add jest and enzyme testing dependencies and update infrastructure configuration to make testing work
This commit is contained in:
16
.eslintrc
16
.eslintrc
@@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"airbnb",
|
"airbnb"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"react": {
|
"react": {
|
||||||
@@ -18,22 +18,24 @@
|
|||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"node": true
|
"node": true,
|
||||||
|
"jest": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"window": true,
|
"window": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"camelcase": "off",
|
"camelcase": "off",
|
||||||
"arrow-parens": "off",
|
"arrow-parens": "off",
|
||||||
"comma-dangle": "off",
|
"comma-dangle": "off",
|
||||||
|
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
|
||||||
"indent": ["error", 2, {
|
"indent": ["error", 2, {
|
||||||
"SwitchCase": 1
|
"SwitchCase": 1
|
||||||
}],
|
}],
|
||||||
"max-len": ['error', {
|
"max-len": ["error", {
|
||||||
"code": 100,
|
"code": 100,
|
||||||
"ignoreStrings": true,
|
"ignoreStrings": true,
|
||||||
"ignoreTemplateLiterals": true,
|
"ignoreTemplateLiterals": true
|
||||||
}],
|
}],
|
||||||
"no-continue": "off",
|
"no-continue": "off",
|
||||||
"no-debugger": "off",
|
"no-debugger": "off",
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
"no-plusplus": "off",
|
"no-plusplus": "off",
|
||||||
"no-underscore-dangle": "off",
|
"no-underscore-dangle": "off",
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
"no-multiple-empty-lines": ["error", { max: 1 }],
|
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
||||||
"object-curly-newline": "off",
|
"object-curly-newline": "off",
|
||||||
"space-before-function-paren": ["error", "always"],
|
"space-before-function-paren": ["error", "always"],
|
||||||
"no-trailing-spaces": ["error"],
|
"no-trailing-spaces": ["error"],
|
||||||
|
|||||||
1
__tests__/stubs/svgStub.js
Normal file
1
__tests__/stubs/svgStub.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = 'svg-stub';
|
||||||
4
enzyme.config.js
Normal file
4
enzyme.config.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
const enzyme = require('enzyme');
|
||||||
|
const Adapter = require('enzyme-adapter-react-16');
|
||||||
|
|
||||||
|
enzyme.configure({ adapter: new Adapter() });
|
||||||
31
package.json
31
package.json
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
|
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "jest --watchAll",
|
||||||
"lint": "./node_modules/eslint/bin/eslint.js src/**/*.js src/**/*.jsx"
|
"lint": "./node_modules/eslint/bin/eslint.js src/**/*.js src/**/*.jsx"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@@ -14,16 +14,20 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-eslint": "^10.0.0",
|
"babel-eslint": "^10.0.0",
|
||||||
|
"babel-jest": "^23.6.0",
|
||||||
"babel-loader": "^7.1.5",
|
"babel-loader": "^7.1.5",
|
||||||
"babel-preset-react": "^6.24.1",
|
"babel-preset-react": "^6.24.1",
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
"css-loader": "^1.0.0",
|
"css-loader": "^1.0.0",
|
||||||
|
"enzyme": "^3.7.0",
|
||||||
|
"enzyme-adapter-react-16": "^1.6.0",
|
||||||
"eslint": "^5.6.0",
|
"eslint": "^5.6.0",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-plugin-import": "^2.14.0",
|
"eslint-plugin-import": "^2.14.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.1.1",
|
"eslint-plugin-jsx-a11y": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.11.1",
|
"eslint-plugin-react": "^7.11.1",
|
||||||
"file-loader": "^2.0.0",
|
"file-loader": "^2.0.0",
|
||||||
|
"jest": "^23.6.0",
|
||||||
"node-sass": "^4.9.3",
|
"node-sass": "^4.9.3",
|
||||||
"react-hot-loader": "^4.3.3",
|
"react-hot-loader": "^4.3.3",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^7.1.0",
|
||||||
@@ -42,5 +46,30 @@
|
|||||||
"react-redux": "^5.0.7",
|
"react-redux": "^5.0.7",
|
||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"redux": "^4.0.0"
|
"redux": "^4.0.0"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"collectCoverageFrom": [
|
||||||
|
"src/**/*.{js,jsx}"
|
||||||
|
],
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"^[./a-zA-Z0-9$_-]+\\.svg$": "<rootDir>/__tests__/stubs/svgStub.js"
|
||||||
|
},
|
||||||
|
"setupTestFrameworkScriptFile": "<rootDir>/enzyme.config.js",
|
||||||
|
"testMatch": [
|
||||||
|
"<rootDir>/__tests__/tests/**/*.{js,jsx}"
|
||||||
|
],
|
||||||
|
"testEnvironment": "jsdom",
|
||||||
|
"testURL": "http://127.0.0.1:3001",
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest"
|
||||||
|
},
|
||||||
|
"transformIgnorePatterns": [
|
||||||
|
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"babel": {
|
||||||
|
"presets": [
|
||||||
|
"react-app"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
const TARGET_PORT = 8043;
|
const TARGET_PORT = 8043;
|
||||||
const TARGET = `https://localhost:${TARGET_PORT}`;
|
const TARGET = `https://localhost:${TARGET_PORT}`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user