test: fix jest test for typescript (#3169)

* fix jest test for typescript

* fix components detect tc

* remove console
This commit is contained in:
偏右 2016-09-27 13:40:34 +08:00 committed by Benjy Cui
parent bb22f7864b
commit 51da9c637c
6 changed files with 12 additions and 28 deletions

View File

@ -99,7 +99,7 @@
"eslint-plugin-react": "^6.1.2",
"eslint-tinker": "^0.4.0",
"history": "^3.0.0",
"jest-cli": "^13.2.3",
"jest-cli": "^15.1.1",
"jsonml-to-react-component": "~0.2.0",
"jsonml.js": "^0.1.0",
"jsonp": "^0.2.0",
@ -123,9 +123,9 @@
"react-stateless-wrapper": "^1.0.2",
"react-sublime-video": "^0.2.0",
"reqwest": "^2.0.5",
"typescript-babel-jest": "^0.1.5",
"typings": "^1.3.2",
"values.js": "^1.0.3",
"webpack-babel-jest": "^1.0.4"
"values.js": "^1.0.3"
},
"scripts": {
"dist": "antd-tools run dist",
@ -141,8 +141,8 @@
"demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
"lesshint": "lesshint components -r scripts/lesshint-report.js",
"eslint-fix": "eslint --fix test site scripts ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx,.tsx' --ignore-pattern '!.eslintrc.js' && eslint-tinker ./components/*/demo/*.md",
"test": "npm run lint && npm run dist",
"jest": "jest",
"test": "npm run lint && npm run dist && npm run jest",
"jest": "jest --no-cache",
"pre-publish": "node ./scripts/prepub",
"prepublish": "antd-tools run guard",
"pub": "antd-tools run update-self && antd-tools run pub",
@ -150,21 +150,20 @@
},
"jest": {
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
],
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/*"
],
"modulePathIgnorePatterns": [
"/_site/"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"scriptPreprocessor": "<rootDir>/node_modules/webpack-babel-jest",
"testDirectoryName": "tests"
"scriptPreprocessor": "node_modules/typescript-babel-jest",
"testRegex": "(/tests/.*|\\.(test|spec))\\.(js)$"
},
"pre-commit": [
"lint"

View File

@ -1,6 +1,3 @@
jest.unmock('../components/button/button');
jest.unmock('../components/icon/index');
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Button from '../components/button/button';

View File

@ -1,5 +1,3 @@
jest.unmock('../components/icon/index');
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import { wrap } from 'react-stateless-wrapper';

View File

@ -8,8 +8,6 @@ describe('antd dist files', function() {
if (!distFilesExisted) {
it('empty test case placeholder', () => {});
return;
} else {
jest.unmock('../dist/antd');
}
// fixed jsdom miss
@ -33,6 +31,8 @@ describe('antd dist files', function() {
it('should has modules in antd', () => {
expect('Affix' in antd).toBeTruthy();
expect('Alert' in antd).toBeTruthy();
expect('AutoComplete' in antd).toBeTruthy();
expect('BackTop' in antd).toBeTruthy();
expect('Badge' in antd).toBeTruthy();
expect('Breadcrumb' in antd).toBeTruthy();
expect('Button' in antd).toBeTruthy();
@ -53,12 +53,12 @@ describe('antd dist files', function() {
expect('Menu' in antd).toBeTruthy();
expect('message' in antd).toBeTruthy();
expect('Modal' in antd).toBeTruthy();
expect('Mention' in antd).toBeTruthy();
expect('notification' in antd).toBeTruthy();
expect('Pagination' in antd).toBeTruthy();
expect('Popconfirm' in antd).toBeTruthy();
expect('Popover' in antd).toBeTruthy();
expect('Progress' in antd).toBeTruthy();
expect('QueueAnim' in antd).toBeTruthy();
expect('Radio' in antd).toBeTruthy();
expect('Rate' in antd).toBeTruthy();
expect('Row' in antd).toBeTruthy();
@ -77,8 +77,6 @@ describe('antd dist files', function() {
expect('Tree' in antd).toBeTruthy();
expect('TreeSelect' in antd).toBeTruthy();
expect('Upload' in antd).toBeTruthy();
expect('Validation' in antd).toBeTruthy();
expect('BackTop' in antd).toBeTruthy();
});
// https://github.com/ant-design/ant-design/issues/1970

View File

@ -1,7 +1,3 @@
jest.unmock('../components/layout/index');
jest.unmock('../components/layout/col');
jest.unmock('../components/layout/row');
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import { wrap } from 'react-stateless-wrapper';

View File

@ -1,7 +1,3 @@
jest.unmock('../components/popover/placements');
jest.unmock('../components/popover/index');
jest.unmock('../components/tooltip/index');
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Popover from '../components/popover/index';