Browse Source

Run demo test against dist/lib/es dir

pull/6646/merge
Wei Zhu 8 years ago
parent
commit
1f69de8da4
  1. 48
      .jest.js
  2. 21
      .jest.node.js
  3. 19
      .jest.node.json
  4. 5
      .travis.yml
  5. 47
      package.json
  6. 7
      scripts/test-all.sh

48
.jest.js

@ -0,0 +1,48 @@
const libDir = process.env.LIB_DIR;
const transformIgnorePatterns = [
'/dist/',
'/node_modules/reqwest',
];
if (libDir !== 'es') {
transformIgnorePatterns.push('/node_modules/');
}
module.exports = {
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'md',
],
modulePathIgnorePatterns: [
'/_site/',
],
testPathIgnorePatterns: [
'/node_modules/',
'dekko',
'node',
],
transform: {
'\\.tsx?$': './node_modules/typescript-babel-jest',
'\\.js$': './node_modules/babel-jest',
'\\.md$': './node_modules/antd-demo-jest',
},
testRegex: libDir ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'!components/*/style/index.tsx',
'!components/style/index.tsx',
'!components/*/locale/index.tsx',
],
transformIgnorePatterns,
snapshotSerializers: [
'enzyme-to-json/serializer',
],
};

21
.jest.node.js

@ -0,0 +1,21 @@
module.exports = {
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'md',
],
transform: {
'\\.tsx?$': './node_modules/typescript-babel-jest',
'\\.js$': './node_modules/babel-jest',
'\\.md$': './node_modules/antd-demo-jest',
},
testRegex: 'demo\\.test\\.js$',
testEnvironment: 'node',
snapshotSerializers: [
'enzyme-to-json/serializer'
],
};

19
.jest.node.json

@ -1,19 +0,0 @@
{
"setupFiles": [
"./tests/setup.js"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"md"
],
"transform": {
"\\.tsx?$": "./node_modules/typescript-babel-jest",
"\\.js$": "./node_modules/babel-jest",
"\\.md$": "./node_modules/antd-demo-jest"
},
"testRegex": "demo\\.test\\.js$",
"testEnvironment": "node",
"snapshotSerializers": ["enzyme-to-json/serializer"]
}

5
.travis.yml

@ -20,13 +20,16 @@ script:
elif [ "$TEST_TYPE" = dist ]; then
npm run dist && \
node ./tests/dekko/dist.test.js
LIB_DIR=dist npm test -- --coverage -w 2
elif [ "$TEST_TYPE" = compile ]; then
npm run compile && \
node ./tests/dekko/lib.test.js
LIB_DIR=es npm test -- --coverage -w 2
LIB_DIR=lib npm test -- --coverage -w 2
elif [ "$TEST_TYPE" = test:dom ]; then
npm run dist && \
npm test -- --coverage -w 2 && \
bash <(curl -s https://codecov.io/bash)
elif [ "$TEST_TYPE" = test:node ]; then
npm test -- --config .jest.node.json -w 2
npm run test-node -- -w 2
fi

47
package.json

@ -81,7 +81,7 @@
"devDependencies": {
"@types/react": "^15.0.8",
"@types/react-dom": "~0.14.18",
"antd-demo-jest": "^1.0.5",
"antd-demo-jest": "^1.3.0",
"antd-tools": "~1.5.0",
"babel-cli": "^6.18.0",
"babel-eslint": "^7.1.0",
@ -116,7 +116,7 @@
"eslint-tinker": "^0.4.0",
"fetch-jsonp": "^1.0.3",
"glob": "^7.1.1",
"jest": "^19.0.2",
"jest": "^20.0.4",
"jsonml.js": "^0.1.0",
"lint-staged": "^3.3.1",
"mockdate": "^2.0.1",
@ -145,7 +145,8 @@
"xhr2": "^0.1.3"
},
"scripts": {
"test": "jest",
"test": "jest --config .jest.js",
"test-node": "jest --config .jest.node.js",
"test-all": "./scripts/test-all.sh",
"lint": "npm run lint:ts && npm run lint:es && npm run lint:demo && npm run lint:style",
"lint:ts": "npm run tsc && antd-tools run ts-lint",
@ -183,46 +184,6 @@
"lint-staged:demo"
]
},
"jest": {
"setupFiles": [
"./tests/setup.js"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"md"
],
"modulePathIgnorePatterns": [
"/_site/"
],
"testPathIgnorePatterns": [
"/node_modules/",
"dekko",
"node"
],
"transform": {
"\\.tsx?$": "./node_modules/typescript-babel-jest",
"\\.js$": "./node_modules/babel-jest",
"\\.md$": "./node_modules/antd-demo-jest"
},
"testRegex": ".*\\.test\\.js$",
"collectCoverageFrom": [
"components/**/*.{ts,tsx}",
"!components/*/style/index.tsx",
"!components/style/index.tsx",
"!components/*/locale/index.tsx"
],
"transformIgnorePatterns": [
"/node_modules/",
"/dist/"
],
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
},
"pre-commit": [
"lint-staged"
]

7
scripts/test-all.sh

@ -3,7 +3,10 @@
npm run lint && \
npm run dist && \
node ./tests/dekko/dist.test.js && \
LIB_DIR=dist npm test && \
npm run compile && \
node ./tests/dekko/lib.test.js && \
npm test -- --coverage -w $MAX_WORKERS && \
npm test -- --config .jest.node.json -w $MAX_WORKERS
LIB_DIR=es npm test && \
LIB_DIR=lib npm test && \
npm test && \
npm run test-node

Loading…
Cancel
Save