From 6ae1530744009b5a0a77537a77563c2b400cf2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Wed, 10 Jan 2018 19:24:57 +0800 Subject: [PATCH] Use roadhog test (#640) * update .gitignore * Use roadhog test replace jest * upgrade roadhog --- package.json | 42 +++--------------------------------------- tests/jasmine.js | 1 - tests/setupTests.js | 16 ---------------- tests/styleMock.js | 1 - 4 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 tests/jasmine.js delete mode 100644 tests/setupTests.js delete mode 100644 tests/styleMock.js diff --git a/package.json b/package.json index 5bea1003..8c6e26ab 100755 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js", - "test": "jest", - "test:comps": "jest ./src/components", + "test": "roadhog test", + "test:component": "roadhog test ./src/components", "test:all": "node ./tests/run-tests.js" }, "dependencies": { @@ -46,20 +46,13 @@ "react-fittext": "^1.0.0" }, "devDependencies": { - "@babel/core": "^7.0.0-beta.37", - "@babel/preset-env": "^7.0.0-beta.36", - "@babel/preset-react": "^7.0.0-beta.36", - "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^8.1.2", - "babel-jest": "^22.0.4", "babel-plugin-dva-hmr": "^0.4.1", "babel-plugin-import": "^1.6.3", - "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.4", "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", "enzyme": "^3.1.0", - "enzyme-adapter-react-16": "^1.0.2", "eslint": "^4.14.0", "eslint-config-airbnb": "^16.0.0", "eslint-plugin-babel": "^4.0.0", @@ -70,15 +63,12 @@ "eslint-plugin-react": "^7.0.1", "gh-pages": "^1.0.0", "husky": "^0.14.3", - "jest": "^22.0.4", - "jsdom": "^11.5.1", "lint-staged": "^6.0.0", "mockjs": "^1.0.1-beta3", "pro-download": "^1.0.1", - "react-test-renderer": "^16.2.0", "redbox-react": "^1.5.0", "regenerator-runtime": "^0.11.1", - "roadhog": "^2.0.6", + "roadhog": "^2.1.0", "roadhog-api-doc": "^0.3.4", "rollbar": "^2.3.4", "stylelint": "^8.4.0", @@ -87,32 +77,6 @@ "optionalDependencies": { "nightmare": "^2.10.0" }, - "babel": { - "presets": [ - "@babel/preset-env", - "@babel/preset-react" - ], - "plugins": [ - "transform-decorators-legacy", - "transform-class-properties" - ] - }, - "jest": { - "setupFiles": [ - "/tests/setupTests.js" - ], - "testMatch": [ - "**/?(*.)(spec|test|e2e).js?(x)" - ], - "setupTestFrameworkScriptFile": "/tests/jasmine.js", - "moduleFileExtensions": [ - "js", - "jsx" - ], - "moduleNameMapper": { - "\\.(css|less)$": "/tests/styleMock.js" - } - }, "lint-staged": { "**/*.{js,jsx}": "lint-staged:js", "**/*.less": "stylelint --syntax less" diff --git a/tests/jasmine.js b/tests/jasmine.js deleted file mode 100644 index 5ff26bff..00000000 --- a/tests/jasmine.js +++ /dev/null @@ -1 +0,0 @@ -jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000; diff --git a/tests/setupTests.js b/tests/setupTests.js deleted file mode 100644 index 0fb8aa7f..00000000 --- a/tests/setupTests.js +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable import/first */ -global.requestAnimationFrame = - global.requestAnimationFrame || function requestAnimationFrame(callback) { - setTimeout(callback, 0); - }; -import { JSDOM } from 'jsdom'; -import Enzyme from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -Enzyme.configure({ adapter: new Adapter() }); - -// fixed jsdom miss -const documentHTML = '
'; -global.document = new JSDOM(documentHTML); -global.window = document.defaultView; -global.navigator = global.window.navigator; diff --git a/tests/styleMock.js b/tests/styleMock.js deleted file mode 100644 index f053ebf7..00000000 --- a/tests/styleMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; -- GitLab