Skip to content

Commit 9c74e94

Browse files
committed
serve MathJax assets in karma tests (w/o bundling them)
- so that one can include MathJax by adding a <script> for a given test.
1 parent 187ffd0 commit 9c74e94

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/jasmine/karma.conf.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@ var isFullSuite = !isBundleTest && argv._.length === 0;
8888
var testFileGlob;
8989

9090
if(isFullSuite) {
91-
testFileGlob = path.join('tests', '*' + SUFFIX);
91+
testFileGlob = path.join(__dirname, 'tests', '*' + SUFFIX);
9292
} else if(isBundleTest) {
9393
var _ = merge(argv.bundleTest);
9494

9595
if(_.length > 1) {
9696
console.warn('Can only run one bundle test suite at a time, ignoring ', _.slice(1));
9797
}
9898

99-
testFileGlob = path.join('bundle_tests', glob([basename(_[0])]));
99+
testFileGlob = path.join(__dirname, 'bundle_tests', glob([basename(_[0])]));
100100
} else {
101-
testFileGlob = path.join('tests', glob(merge(argv._).map(basename)));
101+
testFileGlob = path.join(__dirname, 'tests', glob(merge(argv._).map(basename)));
102102
}
103103

104104
var pathToShortcutPath = path.join(__dirname, '..', '..', 'tasks', 'util', 'shortcut_paths.js');
@@ -107,6 +107,7 @@ var pathToJQuery = path.join(__dirname, 'assets', 'jquery-1.8.3.min.js');
107107
var pathToIE9mock = path.join(__dirname, 'assets', 'ie9_mock.js');
108108
var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
109109
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
110+
var pathToMathJax = path.join(constants.pathToDist, 'extras', 'mathjax');
110111

111112
var reporters = (isFullSuite && !argv.tags) ? ['dots', 'spec'] : ['progress'];
112113
if(argv.failFast) reporters.push('fail-fast');
@@ -134,7 +135,7 @@ function func(config) {
134135
func.defaultConfig = {
135136

136137
// base path that will be used to resolve all patterns (eg. files, exclude)
137-
basePath: '.',
138+
basePath: constants.pathToRoot,
138139

139140
// frameworks to use
140141
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@@ -143,7 +144,13 @@ func.defaultConfig = {
143144
// list of files / patterns to load in the browser
144145
//
145146
// N.B. the rest of this field is filled below
146-
files: [pathToCustomMatchers, pathToUnpolyfill],
147+
files: [
148+
pathToCustomMatchers,
149+
pathToUnpolyfill,
150+
// available to fetch from /base/path/to/mathjax
151+
// more info: http://karma-runner.github.io/3.0/config/files.html
152+
{pattern: pathToMathJax + '/**', included: false, watched: false, served: true}
153+
],
147154

148155
// list of files / pattern to exclude
149156
exclude: [],

0 commit comments

Comments
 (0)