Skip to content

Commit

Permalink
Optimize ci scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Oct 23, 2017
1 parent d829f6c commit f03af93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ node_js:
env:
matrix:
- TEST_TYPE=lint
- TEST_TYPE=dist
- TEST_TYPE=compile
- TEST_TYPE=test:dist
- TEST_TYPE=test:lib
- TEST_TYPE=test:es
- TEST_TYPE=test:dom
- TEST_TYPE=test:node

script:
- |
if [ "$TEST_TYPE" = lint ]; then
npm run lint
elif [ "$TEST_TYPE" = dist ]; then
elif [ "$TEST_TYPE" = test: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 dist && \
LIB_DIR=dist npm test -- -w 2
elif [ "$TEST_TYPE" = test:lib ]; 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
LIB_DIR=lib npm test -- -w 2
elif [ "$TEST_TYPE" = test:es ]; then
npm run compile && \
LIB_DIR=es npm test -- -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
Expand Down
6 changes: 4 additions & 2 deletions tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import pkg from '../package.json';

const testDist = process.env.LIB_DIR === 'dist';

describe('antd dist files', () => {
// https://github.com/ant-design/ant-design/issues/1638
// https://github.com/ant-design/ant-design/issues/1968
it('exports modules correctly', () => {
const antd = process.env.CI ? require('../dist/antd') : require('../components'); // eslint-disable-line global-require
const antd = testDist ? require('../dist/antd') : require('../components'); // eslint-disable-line global-require
expect(Object.keys(antd)).toMatchSnapshot();
});

// https://github.com/ant-design/ant-design/issues/1970
// https://github.com/ant-design/ant-design/issues/1804
if (process.env.CI) {
if (testDist) {
it('should have antd.version', () => {
const antd = require('../dist/antd'); // eslint-disable-line global-require
expect(antd.version).toBe(pkg.version);
Expand Down

0 comments on commit f03af93

Please sign in to comment.