forked from orbitdb-archive/ipfs-log
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.tests.config.js
76 lines (74 loc) · 1.97 KB
/
webpack.tests.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
'use strict'
const glob = require('glob')
const webpack = require('webpack')
const path = require('path')
module.exports = {
// TODO: put all tests in a .js file that webpack can use as entry point
entry: glob.sync('./test/*.spec.js', { 'ignore': ['./test/replicate.spec.js'] }),
output: {
filename: '../test/browser/bundle.js'
},
target: 'web',
devtool: 'source-map',
node: {
console: false,
process: 'mock',
Buffer: true
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.IgnorePlugin(/mongo|redis/)
],
externals: {
fs: '{}',
fatfs: '{}',
'fs-extra': '{ copy: () => {} }',
rimraf: '{ sync: () => {} }',
'idb-readable-stream': '{}',
runtimejs: '{}',
net: '{}',
'child_process': {},
dns: '{}',
tls: '{}',
bindings: '{}'
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
]
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
moduleExtensions: ['-loader']
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { modules: false }]
],
plugins: ['@babel/syntax-object-rest-spread', '@babel/transform-runtime', '@babel/plugin-transform-modules-commonjs']
}
}
},
// For inlining the fixture keys in browsers tests
{
test: /userA|userB|userC|userD|0358df8eb5def772917748fdf8a8b146581ad2041eae48d66cc6865f11783499a6|032f7b6ef0432b572b45fcaf27e7f6757cd4123ff5c5266365bec82129b8c5f214|02a38336e3a47f545a172c9f77674525471ebeda7d6c86140e7a778f67ded92260|03e0480538c2a39951d054e17ff31fde487cb1031d0044a037b53ad2e028a3e77c$/,
loader: 'json-loader'
}
]
}
}