-
Notifications
You must be signed in to change notification settings - Fork 53
/
karma.conf.js
87 lines (79 loc) · 2.06 KB
/
karma.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
85
86
87
/* eslint-env node */
/* eslint-disable @typescript-eslint/no-var-requires */
const babel = require( '@rollup/plugin-babel' ).babel;
const nodeResolve = require( '@rollup/plugin-node-resolve' ).nodeResolve;
const replace = require( '@rollup/plugin-replace' );
const commonJs = require( '@rollup/plugin-commonjs' );
const polyfillNode = require( 'rollup-plugin-polyfill-node' );
const progress = require( 'rollup-plugin-progress' );
module.exports = function( config ) {
config.set( {
browsers: [ 'Chrome' ],
frameworks: [ 'jasmine' ],
files: [
// Uses single point of entry for improved build performance.
{ pattern: 'tests/unit/index.ts', watched: false }
],
client: {
jasmine: {
random: false
},
args: [
process.env.CKEDITOR_LICENSE_KEY
]
},
preprocessors: {
'tests/unit/index.ts': [ 'rollup' ]
},
reporters: [ 'mocha' ],
rollupPreprocessor: {
output: {
format: 'iife',
name: 'CKEditor4React'
},
watch: {
skipWrite: true
},
plugins: [
!config.silentBuildLogs && progress(),
babel( {
babelHelpers: 'bundled',
presets: [
'@babel/preset-env',
'@babel/preset-typescript',
'@babel/preset-react'
],
extensions: [ '.ts', '.tsx', '.js' ],
exclude: 'node_modules/**'
} ),
nodeResolve( {
preferBuiltins: false,
extensions: [ '.ts', '.tsx', '.js' ]
} ),
commonJs(),
polyfillNode(),
replace( {
preventAssignment: true,
values: {
'process.env.REQUESTED_REACT_VERSION': `"${
process.env.REQUESTED_REACT_VERSION || ''
}"`,
'process.env.NODE_ENV': '"test"'
}
} )
].filter( Boolean ),
onwarn( warning, rollupWarn ) {
if (
// Reduces noise for circular deps.
// https://github.com/rollup/rollup/issues/2271
warning.code !== 'CIRCULAR_DEPENDENCY' &&
// Prevents namespace warning when bundling RTL.
// https://github.com/testing-library/react-testing-library/issues/790
warning.code !== 'NAMESPACE_CONFLICT'
) {
rollupWarn( warning );
}
}
}
} );
};