forked from fullcalendar/fullcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.config.js
93 lines (74 loc) · 3.28 KB
/
karma.config.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
85
86
87
88
89
90
91
92
93
const { writeFileSync } = require('./scripts/lib/util')
writeConfig()
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: [ 'jasmine' ],
// list of files / patterns to load in the browser
// TODO: to test IE11, must comment-out luxon test
files: [
'packages/__tests__/src/base.css',
// fullcalendar CSS must be manually included :(
'packages/core/dist/main.css', // always needs to be first
'packages/daygrid/dist/main.css', // because timegrid depends on it
'packages-premium/timeline/dist/main.css', // because resource-timeline depends on it
'packages?(-premium)/*/dist/main.css',
{ pattern: 'packages?(-premium)/*/dist/main.css.map', included: false, nocache: true, watched: false },
// tests dependencies that are old or depend on order, so put them first
'node_modules/jquery/dist/jquery.js', // because of jquery-simulate and needing-to-be-first
'node_modules/jquery-simulate/jquery.simulate.js', // operates on global jQuery
'node_modules/jasmine-jquery/lib/jasmine-jquery.js', // weird this/root reference confuses rollup
'node_modules/native-promise-only/lib/npo.src.js', // needed by xhr-mock for IE11
'node_modules/xhr-mock/dist/xhr-mock.js', // esm requires node libs
// hack for hoisting workaround. see rollup.config.js
// TODO: afterwards, remove as many of these entries as possible from the root package.json
'node_modules/luxon/build/global/luxon.js',
'node_modules/rrule/dist/es5/rrule.js',
'node_modules/moment/moment.js',
'node_modules/moment/locale/es.js',
'node_modules/moment-timezone/builds/moment-timezone-with-data.js',
'tmp/test-config.js', // a way to dump variables into the test environment
'tmp/tests.js',
{ pattern: 'tmp/tests.js.map', included: false, nocache: true, watched: false }
],
// make console errors aware of source files
preprocessors: {
'**/*.js': ['sourcemap']
},
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage', 'verbose'
reporters: [ 'dots' ],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
autoWatchBatchDelay: 1000, // try to fix karma crashing on imcomplete syntax
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
customLaunchers: {
ChromeHeadless_custom: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox', // needed for TravisCI: https://docs.travis-ci.com/user/chrome#Sandboxing
'--window-size=1280,1696' // some tests only work with larger window (w?, h?)
]
}
}
})
}
function writeConfig() {
let config = {
isCi: Boolean(process.env.CI)
}
writeFileSync(
'tmp/test-config.js',
'window.karmaConfig = ' + JSON.stringify(config)
)
}