diff --git a/Makefile b/Makefile index 6038a5c8..b0987289 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,12 @@ test-cloudapi-graphql: test-frontend: $(MAKE) -C frontend test +.PHONY: test-ui +test-ui: + $(MAKE) -C ui test + .PHONY: test -test: test-cloudapi-graphql test-frontend +test: test-cloudapi-graphql test-frontend test-ui .PHONY: install-cloudapi-graphql install-cloudapi-graphql: diff --git a/ui/.babelrc b/ui/.babelrc index 3de5edda..f964e1ad 100644 --- a/ui/.babelrc +++ b/ui/.babelrc @@ -12,5 +12,15 @@ ["transform-object-rest-spread", { "useBuiltIns": true }] - ] + ], + "env": { + "test": { + "plugins": [ + ["babel-plugin-webpack-loaders", { + "config": "${CONFIG}", + "verbose": true + }] + ] + } + } } diff --git a/ui/Makefile b/ui/Makefile new file mode 100644 index 00000000..4e3bf324 --- /dev/null +++ b/ui/Makefile @@ -0,0 +1,7 @@ +.PHONY: test +test: + yarn run test + +.PHONY: install +install: + yarn diff --git a/ui/package.json b/ui/package.json index dc34b61a..d1966282 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "webpack-dev-server --open --config webpack/index.js", "lint": "eslint .", - "test": "NODE_ENV=test nyc ava test/*.js --verbose", + "test": "BABEL_DISABLE_CACHE=1 NODE_ENV=test CONFIG=$(pwd)/webpack/index.js nyc ava test/*.js --verbose", "build": "NODE_ENV=production webpack --config webpack/index.js", "clean-static": "sh scripts/clean-static.sh", "build-docs-static": "sh scripts/build-docs-static.sh" @@ -22,6 +22,7 @@ "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-syntax-async-functions": "^6.13.0", "babel-plugin-transform-object-rest-spread": "^6.16.0", + "babel-plugin-webpack-loaders": "^0.8.0", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", "babel-register": "^6.16.3", diff --git a/ui/test/index.js b/ui/test/index.js index adde0c48..4f016c6c 100644 --- a/ui/test/index.js +++ b/ui/test/index.js @@ -6,20 +6,8 @@ const { shallow } = enzyme; -test('renders without exploding', (t) => { - const App = require('../src/containers/app'); - const wrapper = shallow(); - t.deepEqual(wrapper.length, 1); -}); - -test('renders without exploding', (t) => { - const Home = require('../src/containers/home'); - const wrapper = shallow(); - t.deepEqual(wrapper.length, 1); -}); - -test('renders without exploding', (t) => { - const NotFound = require('../src/containers/not-found'); - const wrapper = shallow(); +test('renders