forked from jquense/react-widgets
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_test-versions.js
88 lines (63 loc) · 1.69 KB
/
_test-versions.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
'use strict';
var server = require('karma').server
, webpack = require('webpack')
, webpackConfig = require('./webpack.configs').test;
var plugins = webpackConfig.plugins || [];
webpackConfig.externals = {
'react': 'window.React',
'react/addons': 'window.React'
}
var SUPPORTED_VERSIONS = ["0.12.2", "0.13.0"];
series(SUPPORTED_VERSIONS, function(version, idx, next){
console.log('-------------------------------------------');
console.log('------- Testing React version: ' + version );
console.log('-------------------------------------------');
server.start(
config(version)
, function(exitCode) {
if ( exitCode )
process.exit(exitCode)
next();
});
}, function(){
process.exit(0)
})
function config(version){
webpackConfig.plugins = plugins.concat(
new webpack.DefinePlugin({
'__REACT_VERSION__': JSON.stringify(version),
})
)
return {
basePath: '',
frameworks: ['mocha', 'expect'],
files: [
'./vendor/phantomjs-shim.js',
'https://cdnjs.cloudflare.com/ajax/libs/react/' + version + '/react-with-addons.js',
'./vendor/sinon-1.10.3.js',
'./vendor/jquery-1.11.2.min.js',
'_test-bootstrap.js'
],
reporters: ['mocha'],
port: 9876,
colors: true,
autoWatch: false,
singleRun: true,
logLevel: 'INFO',
browsers: ['PhantomJS'],
preprocessors: {
'_test-bootstrap.js': ['webpack']
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
}
}
}
function series(versions, iter, cb){
(function next(idx){
if( idx === versions.length)
return cb && cb()
iter(versions[idx], idx, next.bind(null, idx + 1))
})(0)
}