From 379ddd52519d8693931730ef12da937f4d82d186 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Tue, 31 Jul 2018 22:58:35 +0800 Subject: [PATCH] Update test infrastructure --- .babelrc | 3 +++ package.json | 2 ++ .../assets/tests/components/user/ClosetItem.test.js | 5 ----- yarn.lock | 11 +++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.babelrc b/.babelrc index 4900a1fe..eb341e4b 100644 --- a/.babelrc +++ b/.babelrc @@ -23,6 +23,9 @@ "targets": { "node": "current" }, "ignoreBrowserslistConfig": true }] + ], + "plugins": [ + "dynamic-import-node" ] } } diff --git a/package.json b/package.json index aeb52012..385e475d 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "babel-eslint": "^8.2.6", "babel-jest": "^23.4.2", "babel-loader": "^8.0.0-beta.4", + "babel-plugin-dynamic-import-node": "^2.0.0", "codecov": "^3.0.0", "copy-webpack-plugin": "^4.5.2", "css-loader": "^1.0.0", @@ -80,6 +81,7 @@ "yaml-loader": "^0.5.0" }, "jest": { + "resetMocks": true, "transform": { "^.+\\.js$": "babel-jest", ".*\\.vue$": "vue-jest" diff --git a/resources/assets/tests/components/user/ClosetItem.test.js b/resources/assets/tests/components/user/ClosetItem.test.js index a86cb692..4d86fc53 100644 --- a/resources/assets/tests/components/user/ClosetItem.test.js +++ b/resources/assets/tests/components/user/ClosetItem.test.js @@ -15,11 +15,6 @@ function factory(opt = {}) { }; } -beforeEach(() => { - axios.post.mockReset(); - swal.mockReset(); -}); - test('computed values', () => { const wrapper = mount(ClosetItem, { propsData: factory() }); expect(wrapper.find('img').attributes().src).toBe('/preview/1.png'); diff --git a/yarn.lock b/yarn.lock index dfdfa242..ad8bc101 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1259,6 +1259,13 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" +babel-plugin-dynamic-import-node@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.0.0.tgz#d6fc3f6c5e3bdc34e49c15faca7ce069755c0a57" + dependencies: + babel-plugin-syntax-dynamic-import "^6.18.0" + object.assign "^4.1.0" + babel-plugin-istanbul@^4.1.6: version "4.1.6" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45" @@ -1272,6 +1279,10 @@ babel-plugin-jest-hoist@^23.2.0: version "23.2.0" resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167" +babel-plugin-syntax-dynamic-import@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da" + babel-plugin-syntax-object-rest-spread@^6.13.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"