/
karma.integration.conf.js
84 lines (69 loc) · 2.13 KB
/
karma.integration.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
'use strict';
/**
* @fileoverview
*
* Karma config for integration tests.
*/
/**
* Config generator.
*
* We need to run integration tests on different versions of the Translator
* library. This function allows for the Translator source file location
* to be specified which is loaded onto the global namespace prior to the
* test running.
*
* The library is provided as a UMD and so this logic could be moved to
* the test file(s), which would need to be preprocessed by a module loader
* like RequireJS. As we're already using Google Closure, that could get
* complicated. Furthermore, if a future version of the library is not
* provided as a UMD that approach may fail.
*
* This is a less DRY approach, but is both the simplest implementation as well
* as (arguably) the more future-proof approach.
*
* @param {String} translatorFilename - The filename of the Translator library.
* @returns {*|Object}
*/
var createIntegrationTestConfig = function(translatorFilename)
{
/**
* @type {Object}
*/
var config = require('./karma.common.conf');
config.singleRun = true;
config.autoWatch = false;
config.files = [
// Vendor
'bower_components/es5-shim/es5-shim.js',
'bower_components/angularjs/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
// Closure library
'bower_components/closurelibrary/closure/goog/base.js',
'dist/angular-symfony-translation.js',
// Translator library
'test/lib/' + translatorFilename,
// Translation fixtures
'test/fixture/' + translatorFilename,
// Integration tests
{
pattern: 'test/integration/**.spec.js'
},
// Source files
{
pattern: 'src/**/*.js',
included: false
},
// Closure dependency resolution
{
pattern: 'bower_components/closurelibrary/closure/goog/deps.js',
included: false,
served: false
}
];
config.reporters = ['spec'];
return config;
};
/**
* @type {Function}
*/
module.exports = createIntegrationTestConfig;