-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallaby.js
102 lines (100 loc) · 2.82 KB
/
wallaby.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const jsxtransform = require("fuse-test-runner").wallabyFuseTestLoader;
'use strict';
const path = require('path');
const fs = require('fs');
// const jsxtransform = require('jsx-controls-loader').loader;
module.exports = function(wallaby) {
return {
files: [
'src/setupTests.ts',
'src/*.ts*',
// 'src/*.js',
'src/utils/**/*.ts*',
'!src/*.spec.ts',
'!src/**/*.spec.tsx',
'!src/**/*.spec.ts',
'!src/**/*.d.ts*',
'src/**/*.html',
],
tests: [
// 'src/setupTests.ts',
'src/*.spec.ts',
'src/**/*.spec.tsx',
'src/**/*.spec.ts',
// 'src/**/*.html',
'src/**/snapshots/*.json'
],
compilers: {
'**/*.ts?(x)': wallaby.compilers.typeScript({ jsx: 'react', module: 'commonjs' })
},
preprocessors: {
'**/*.tsx': file => jsxtransform(file.content)
},
env: {
type: 'node'
},
workers: {
initial: 1,
regular: 1
},
hints: {
ignoreCoverage: /ignore coverage/
},
delays: {
run: 200
},
testFramework: 'jest',
setup: function(wallaby) {
// console.log('\u2665 setup 49', 'wallaby', wallaby);
const appDirectory = require('fs').realpathSync(process.cwd());
const path = require('path');
const jestConfig = {
mapCoverage: true,
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
setupFiles: [require.resolve('react-scripts-ts/config/polyfills.js')],
setupTestFrameworkScriptFile: path.resolve(appDirectory, './src/setupTests.ts'),
testMatch: [
'.spec.',
],
testEnvironment: 'jsdom',
testURL: 'http://localhost',
transform: {
'^.+\\.css$': require.resolve('react-scripts-ts/config/jest/cssTransform.js'),
'^.+\\.tsx?$': require.resolve('react-scripts-ts/config/jest/typescriptTransform.js'),
'^(?!.*\\.(js|jsx|css|json|html)$)': require.resolve('react-scripts-ts/config/jest/fileTransform.js'),
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$',
],
moduleNameMapper: {
'^react-native$': 'react-native-web',
},
moduleFileExtensions: [
'web.ts',
'ts',
'web.tsx',
'tsx',
'web.js',
'js',
'web.jsx',
'jsx',
'json',
'html',
'node'
],
globals: {
'ts-jest': {
tsConfigFile: wallaby.localProjectDir + 'tsconfig.json',
},
'__DEV__': true,
chrome: require('sinon-chrome')
},
rootDir: wallaby.localProjectDir,
};
wallaby.testFramework.configure(jestConfig);
},
teardown: function(wallaby) {
// require('apollo-connector-mongodb').stopDatabase();
}
};
};