-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallaby_client.js
73 lines (64 loc) · 2.16 KB
/
wallaby_client.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
/* eslint-disable */
var path = require('path');
var fs = require('fs');
var wallabyWebpack = require('wallaby-webpack');
var babel = require('babel-core');
module.exports = function (wallaby) {
// wallaby.defaults.files.instrument = false;
// wallaby.defaults.tests.instrument = false;
var webpackConfig = {
resolve: {
root: path.join(wallaby.projectCacheDir, 'src', 'imports'),
extensions: ['', '.js', '.jsx', '.json']
},
module: {
loaders: [
// JavaScript is handled by the Wallaby Babel compiler
{ test: /\.json$/, loader: 'json-loader' }
]
}
};
var wallabyPostprocessor = wallabyWebpack(webpackConfig);
var babelCompiler = wallaby.compilers.babel({
babel: babel,
presets: ['react', 'es2015']
});
var appManifest = require(
path.resolve('./src/.meteor/local/build/programs/web.browser/program.json')
).manifest;
var meteorPackageFiles = appManifest.filter(function (file) {
return file.type === 'js' && file.path.startsWith('packages/') &&
[].indexOf(file.path) === -1;
}).map(function (file) {
var basePath ='src/.meteor/local/build/programs/web.browser';
return { pattern: path.join(basePath, file.path), instrument: false };
});
return {
files: [
'src/.meteor/local/build/programs/web.browser/merged-stylesheets.css',
'src/imports/utility/testing/__meteor_runtime_config__.js'
].concat(
meteorPackageFiles,
[
{ pattern: 'src/imports/**/*.js', load: false },
{ pattern: 'src/imports/**/*.tests.@(js|jsx)', ignore: true },
{ pattern: 'src/imports/**/server/**/*.@(js|jsx)', ignore: true }
]
),
tests: [
{ pattern: 'tests/**/*.tests.js', load: false, instrument: false },
{ pattern: 'tests/**/server/**/*.tests.js', ignore: true }
],
compilers: {
// Important: Make sure that src/.meteor/ is excluded from the pattern
'src/imports/**/*.@(js|jsx)': babelCompiler,
'tests/**/*.@(js|jsx)': babelCompiler,
},
postprocessor: wallabyPostprocessor,
bootstrap: function () {
window.__moduleBundler.loadTests();
},
testFramework: 'mocha',
debug: false
};
};