Skip to content

Commit

Permalink
Run demo test against dist/lib/es dir
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Jun 30, 2017
1 parent 0ce61df commit 1f69de8
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 65 deletions.
48 changes: 48 additions & 0 deletions .jest.js
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions .jest.node.js
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 19 deletions .jest.node.json

This file was deleted.

5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 4 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
Expand Down
7 changes: 5 additions & 2 deletions scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1f69de8

Please sign in to comment.