mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Configure karma to load angular, requirejs and test/source files
Use test-main.js file to configure requirejs so that AMD loader can be used
This commit is contained in:
@@ -10,7 +10,19 @@ module.exports = function (config) {
|
||||
}
|
||||
},
|
||||
browsers: ['ChromeCustom'],
|
||||
files: [],
|
||||
files: [
|
||||
'test/unit_frontend/js/bootstrap.js',
|
||||
// Angular must be loaded before requirejs to set up angular global
|
||||
'public/js/libs/angular-1.6.4.min.js',
|
||||
'public/js/libs/angular-mocks.js',
|
||||
'public/js/libs/jquery-1.11.1.min.js',
|
||||
// Set up requirejs
|
||||
'test/unit_frontend/js/test-main.js',
|
||||
// Include source & test files, but don't "include" them as requirejs
|
||||
// handles this for us
|
||||
{ pattern: 'public/js/**/*.js', included: false },
|
||||
{ pattern: 'test/unit_frontend/js/**/*.js', included: false }
|
||||
],
|
||||
frameworks: ['requirejs', 'mocha', 'chai-sinon'],
|
||||
plugins: [
|
||||
require('karma-requirejs'),
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Set up requirejs to load the tests
|
||||
# Uses heuristic that test filenames end with Tests.js
|
||||
tests = []
|
||||
for file of window.__karma__.files
|
||||
if window.__karma__.files.hasOwnProperty(file)
|
||||
if /Tests\.js$/.test(file)
|
||||
tests.push(file)
|
||||
|
||||
requirejs.config
|
||||
baseUrl: '/base/public/js'
|
||||
paths:
|
||||
"moment": "libs/moment-2.9.0"
|
||||
deps: tests
|
||||
callback: window.__karma__.start
|
||||
Reference in New Issue
Block a user