Add simple test

This commit is contained in:
afc163 2015-11-02 21:34:52 +08:00
parent 371c00bb69
commit 9ef72bae9d
3 changed files with 33 additions and 1 deletions

View File

@ -73,6 +73,7 @@
"babel": "^5.8.29",
"babel-core": "^5.8.29",
"babel-eslint": "^4.1.0",
"babel-jest": "~5.3.0",
"babel-loader": "^5.3.2",
"busboy": "^0.2.9",
"chalk": "^1.1.0",
@ -83,6 +84,7 @@
"eslint-plugin-react": "^3.3.1",
"extract-text-webpack-plugin": "^0.8.1",
"gh-pages": "^0.3.1",
"jest-cli": "~0.6.1",
"json-loader": "^0.5.1",
"less": "~2.5.1",
"less-loader": "^2.2.0",
@ -104,11 +106,24 @@
"just-deploy": "npm run clean && webpack --config webpack.deploy.config.js && NODE_ENV=PRODUCTION nico build && node scripts/deploy.js",
"lint": "eslint components index.js --ext '.js,.jsx'",
"lesslint": "lesslint style",
"test": "npm run lint && webpack",
"test": "BABEL_ENV=test BABEL_JEST_STAGE=2 jest",
"pub": "sh ./scripts/publish.sh",
"webpack": "webpack",
"beta": "sh ./scripts/publish.sh --tag beta"
},
"jest": {
"rootDir": ".",
"moduleFileExtensions": [
"js",
"jsx",
"json"
],
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/*"
],
"scriptPreprocessor": "<rootDir>/scripts/jest-script-preprocessor",
"testDirectoryName": "tests"
},
"precommit": [
"lint"
]

View File

@ -0,0 +1,9 @@
// jest-script-preprocessor.js
var babelJest = require("babel-jest");
module.exports = {
process: function(src, filename) {
return babelJest.process(src, filename)
.replace(/^require.*\.less.*;$/gm, '');
}
};

8
tests/exports.js Normal file
View File

@ -0,0 +1,8 @@
jest.dontMock('../index');
var antd = require('../index');
describe('antd', function() {
it('antd should be existd', function() {
expect(antd).toBeTruthy();
});
});