-
Notifications
You must be signed in to change notification settings - Fork 33
/
wallaby.conf.js
57 lines (55 loc) · 1.73 KB
/
wallaby.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
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const compilerOptions = Object.assign({
'esModuleInterop': true,
'target': 'esnext',
'module': 'commonjs'
})
module.exports = function (wallaby) {
return {
files: [
'packages/**/src/**/*.ts',
'packages/**/fixtures.ts',
'!packages/**/test/**/*.test.ts',
'!packages/**/node_modules/**',
'!packages/**/build/**',
'!packages/*-+(browser|backend)/**/*.ts'
],
tests: [
'packages/**/test/**/*test.ts',
'!packages/**/node_modules/**',
'!packages/**/build/**',
'!packages/*-+(browser|backend)/**/*.ts'
],
filesWithNoCoverageCalculated: [
'packages/**/src/index.ts'
],
testFramework: 'mocha',
compilers: {
'**/*.ts': wallaby.compilers.typeScript(compilerOptions)
},
env: { type: 'node' },
debug: true,
setup: w => {
const { projectCacheDir } = w
const path = require('path')
const { Module } = require('module')
const fs = require('fs')
if (!Module._originalRequire) {
const modulePrototype = Module.prototype
Module._originalRequire = modulePrototype.require
modulePrototype.require = function (filePath) {
if (!filePath.startsWith('@aws-crypto')) {
return Module._originalRequire.call(this, filePath)
}
const [, _module] = filePath.split('/')
const _filePath = path.join(projectCacheDir, 'modules', _module, 'src', 'index.js')
if (!fs.existsSync(_filePath)) {
return Module._originalRequire.call(this, filePath)
}
return Module._originalRequire.call(this, _filePath)
}
}
}
}
}