This repository has been archived by the owner on Jun 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
/
wallaby.config.ts
82 lines (70 loc) · 2.6 KB
/
wallaby.config.ts
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
import {
IWallaby,
IWallabyConfig,
IWallabyCompilers,
IWallabyProcessor,
IWallabyFilePattern,
IWallabyEnvironment
} from 'wallabyjs';
import { BuildConfig } from './build/config/build';
import { WebPackConfig } from './build/config/webpack';
class WallabyConfig implements IWallabyConfig {
public files: IWallabyFilePattern[] = [
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/angular/angular.js' },
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/angular-mocks/angular-mocks.js' },
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/jquery/dist/jquery.min.js' },
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/pickadate/lib/picker.js' },
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/pickadate/lib/picker.date.js' },
{ instrument: false, pattern: BuildConfig.NODE_MODULES + '/jasmine-jquery/lib/jasmine-jquery.js' },
{ instrument: false, pattern: 'src/core/jquery.phantomjs.fix.js' },
{ load: false, pattern: 'src/**/*.ts' },
{ ignore: true, pattern: 'src/**/*.spec.ts' }
];
public tests: IWallabyFilePattern[] = [
{ load: false, pattern: 'src/**/*.spec.ts' },
{ load: false, pattern: 'src/**/*.ts' }
];
public compilers: IWallabyCompilers = {
'src/**/*.ts': this.wallaby.compilers.typeScript()
};
public env: IWallabyEnvironment = <IWallabyEnvironment>{
params: { runner: '--web-security=false' },
runner: require('phantomjs2-ext').path,
viewportSize: { width: 600 }
};
public postprocessor: IWallabyProcessor;
/**
* Configure testing framework / sandbox environment just before a test run starts.
*/
public setup: any = function (): void {
// required to trigger test loader
let moduleBundle: string = '__moduleBundler';
window[moduleBundle].loadTests();
};
constructor(private wallaby: IWallaby) {
this.configPostProcessor();
}
/**
* Configure the Wallaby postprocessor for webpack.
*/
private configPostProcessor(): void {
let webpackConfig: WebPackConfig = new WebPackConfig();
this.postprocessor = require('wallaby-webpack')({
entryPatterns: [
'src/core/components.js',
'src/core/core.js',
'src/**/*.spec.js'
],
externals: webpackConfig.externals,
// can't use same resolve from webpack config because with regular
// webpack, need to load TS then JS, but with Wallaby, need JS then TS
resolve: {
extensions: ['.js', '.ts'],
modules: webpackConfig.resolve.modules
}
});
}
}
module.exports = (wallaby: IWallaby) => {
return new WallabyConfig(wallaby);
};