Browse Source

Add simple test

pull/464/head
afc163 9 years ago
parent
commit
9ef72bae9d
  1. 17
      package.json
  2. 9
      scripts/jest-script-preprocessor.js
  3. 8
      tests/exports.js

17
package.json

@ -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"
]

9
scripts/jest-script-preprocessor.js

@ -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

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