forked from KillerCodeMonkey/ngx-quill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.test.js
More file actions
57 lines (52 loc) · 1.13 KB
/
webpack.config.test.js
File metadata and controls
57 lines (52 loc) · 1.13 KB
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
const ENV = process.env.npm_lifecycle_event
const isTestWatch = ENV === 'test-watch'
const isTest = ENV === 'test' || isTestWatch
const path = require('path')
let _config = {
resolve: {
extensions: ['.ts', '.js']
},
entry: {
'ngx-quill': path.resolve(__dirname, 'index.ts')
}
}
if (isTest) {
_config.devtool = 'inline-source-map'
}
let atlOptions = ''
if (isTest && !isTestWatch) {
// awesome-typescript-loader needs to output inlineSourceMap for code coverage to work with source maps.
atlOptions = {
inlineSourceMap: true,
sourceMap: false
}
}
_config.module = {
rules: []
}
_config.module.rules.push({
test: /\.ts$/,
use: [{
loader: 'awesome-typescript-loader',
options: atlOptions
}]
})
if (isTest && !isTestWatch) {
// instrument only testing sources with Istanbul, covers ts files
_config.module.rules.push({
test: /\.ts$/,
enforce: 'post',
use: [{
loader: 'istanbul-instrumenter-loader',
options: {
embedSource: true,
noAutoWrap: true
}
}],
exclude: [
'node_modules',
/\.(e2e|spec)\.ts$/
]
})
}
module.exports = _config