Make JS_SPEC_MATCHER work again

After the karma upgrade some things changed around that essentially
made it not work at all.  This makes it so that it works again.

In testing when JS_SPEC_MATCHER was set to **/*BreadcrumbsSpec it matched
properly, but the tests failed for some reason.  Other tests seemed to
pass as expected.  I'm pretty sure it has something to dow with requirejs
not loading something properly, but it's pretty isolated..

Change-Id: I2720ba97252ee4d3c18f350c22a02aa58df93be3
Reviewed-on: https://gerrit.instructure.com/87681
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
Clay Diffrient 2016-08-12 13:08:14 -06:00
parent 3fce1ac602
commit 5271f3f26f
1 changed files with 47 additions and 19 deletions

View File

@ -1,4 +1,5 @@
var fs = require("fs");
const glob = require('glob');
var webpackFileExists = false;
var webpackFilePath = __dirname + "/config/WEBPACK";
@ -24,27 +25,54 @@ if (usingWebpack) {
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true}
];
}else{
karmaFiles = [
'spec/javascripts/requirejs_config.js',
'spec/javascripts/tests.js',
'public/javascripts/vendor/require.js',
'node_modules/karma-requirejs/lib/adapter.js',
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/sinon/sinon-qunit-1.0.0.js',
'spec/javascripts/support/axe.js',
{pattern: 'public/javascripts/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*.html', included: false, served: true},
{pattern: 'spec/javascripts/tests.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/*.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/**/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true},
{pattern: 'public/javascripts/**/*.js', included: false, served: true},
{pattern: 'public/dist/brandable_css/**/*.css', included: false, served: true},
'spec/javascripts/load_tests.js'
]
if (process.env.JS_SPEC_MATCHER) {
const files = glob.sync(process.env.JS_SPEC_MATCHER);
console.log('These spec files were matched:');
console.log(files);
karmaFiles = [
'spec/javascripts/requirejs_config.js',
'spec/javascripts/tests.js',
'public/javascripts/vendor/require.js',
'node_modules/karma-requirejs/lib/adapter.js',
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/sinon/sinon-qunit-1.0.0.js',
'spec/javascripts/support/axe.js',
{pattern: 'public/javascripts/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*.html', included: false, served: true},
{pattern: 'spec/javascripts/tests.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/helpers/*.js', included: false, served: true}
];
files.forEach(f => karmaFiles.push({pattern: f, included: false, served: true}));
karmaFiles = karmaFiles.concat([
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true},
{pattern: 'public/javascripts/**/*.js', included: false, served: true},
{pattern: 'public/dist/brandable_css/**/*.css', included: false, served: true},
'spec/javascripts/load_tests.js'
]);
} else {
karmaFiles = [
'spec/javascripts/requirejs_config.js',
'spec/javascripts/tests.js',
'public/javascripts/vendor/require.js',
'node_modules/karma-requirejs/lib/adapter.js',
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/sinon/sinon-qunit-1.0.0.js',
'spec/javascripts/support/axe.js',
{pattern: 'public/javascripts/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*.html', included: false, served: true},
{pattern: 'spec/javascripts/tests.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/*.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/**/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true},
{pattern: 'public/javascripts/**/*.js', included: false, served: true},
{pattern: 'public/dist/brandable_css/**/*.css', included: false, served: true},
'spec/javascripts/load_tests.js'
]
}
}
var karmaConfig = {
basePath: '',