diff --git a/circle.yml b/circle.yml index 9efc0bc1..2a6393a5 100644 --- a/circle.yml +++ b/circle.yml @@ -38,7 +38,7 @@ test: - if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi override: - cd $WS && ./codecheck.sh -u - - cd $WS && NODE_ENV="test" npm test + - cd $WS && npm test deployment: deploy: diff --git a/package.json b/package.json index 405ca9df..280c10f4 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "check-style": "/bin/bash -c '[[ $(npm ls cloudgov-style) =~ \"git://github.com\" ]] && npm run build-style || exit 0'", "clean": "rm -rf ./static/assets/*", "lint": "eslint --ext .js --ext .jsx ./static_src", - "test": "npm run lint && karma start --single-run", + "test": "export NODE_ENV=test && npm run lint && karma start --single-run", "testing-server": "node ./static_src/test/server/server.js", "watch-server": "npm run testing-server & npm run watch", - "watch-test": "karma start --browsers Chrome", + "watch-test": "export NODE_ENV=test && karma start --browsers Chrome", "watch": "webpack --watch" }, "author": "Marco Segreto (marco.segreto@gsa.gov)", diff --git a/static_src/test/global_setup.js b/static_src/test/global_setup.js index 0578e54b..43f70ab3 100644 --- a/static_src/test/global_setup.js +++ b/static_src/test/global_setup.js @@ -1,6 +1,7 @@ require('babel-polyfill'); +import jasmineEnzyme from 'jasmine-enzyme'; Function.prototype.bind = Function.prototype.bind || function (thisp) { var fn = this; @@ -212,6 +213,7 @@ function createJasmineSinonMatchers(matchers) { } beforeEach(function() { + jasmineEnzyme(); jasmine.addMatchers(createJasmineSinonMatchers(sinonMatchers)); //jasmine.addMatchers(reactMatchers); }); diff --git a/webpack.config.js b/webpack.config.js index 3898a041..f5182467 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -89,6 +89,12 @@ const config = { if (TEST) { config.plugins.push(new WebpackKarmaWarningsPlugin()); + config.externals = { + 'cheerio': 'window', + 'react/addons': true, + 'react/lib/ExecutionEnvironment': true, + 'react/lib/ReactContext': true + }; } if (PRODUCTION) {