diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-01-07 03:19:42 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-10 21:30:43 +0300 |
commit | a8078d629e50ec1ea0e562e24e7bd7ea8931d896 (patch) | |
tree | 848320b551cc9a79bcee9f88d3403d305116d89a | |
parent | b0341c14d0657b41203b7e5d6d6cbeb64d67b387 (diff) |
migrate all tests into a single webpack bundle
-rw-r--r-- | config/karma.config.js | 3 | ||||
-rw-r--r-- | spec/javascripts/.eslintrc | 5 | ||||
-rw-r--r-- | spec/javascripts/test_bundle.js (renamed from spec/javascripts/spec_helper.js) | 19 |
3 files changed, 19 insertions, 8 deletions
diff --git a/config/karma.config.js b/config/karma.config.js index 96d33490b37..b317c3f00b2 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -8,8 +8,7 @@ module.exports = function(config) { basePath: ROOT_PATH, frameworks: ['jasmine'], files: [ - 'spec/javascripts/spec_helper.js', - 'spec/javascripts/**/*_spec.js?(.es6)', + 'spec/javascripts/test_bundle.js', { pattern: 'spec/javascripts/fixtures/**/*@(.json|.html|.html.raw)', included: false }, ], preprocessors: { diff --git a/spec/javascripts/.eslintrc b/spec/javascripts/.eslintrc index dcbcd014dc3..b3d191e15ab 100644 --- a/spec/javascripts/.eslintrc +++ b/spec/javascripts/.eslintrc @@ -22,7 +22,8 @@ }, "plugins": ["jasmine"], "rules": { - "prefer-arrow-callback": 0, - "func-names": 0 + "func-names": 0, + "no-console": 0, + "prefer-arrow-callback": 0 } } diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/test_bundle.js index b55f08e3311..cbe8abbbc08 100644 --- a/spec/javascripts/spec_helper.js +++ b/spec/javascripts/test_bundle.js @@ -1,5 +1,9 @@ +// enable test fixtures require('jasmine-jquery'); +jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; +jasmine.getJSONFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; + // include common libraries window.$ = window.jQuery = require('jquery'); window._ = require('underscore'); @@ -21,11 +25,18 @@ require('bootstrap/js/transition'); require('bootstrap/js/tooltip'); require('bootstrap/js/popover'); -// configure jasmine -jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; -jasmine.getJSONFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; - // stub expected globals window.gl = window.gl || {}; window.gl.TEST_HOST = 'http://test.host'; window.gon = window.gon || {}; + +// render all of our tests +const testsContext = require.context('.', true, /_spec$/); +testsContext.keys().forEach(function (path) { + try { + testsContext(path); + } catch (err) { + console.error('[ERROR] WITH SPEC FILE: ', path); + console.error(err); + } +}); |