forked from tastejs/todomvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
allTests.js
80 lines (71 loc) · 2.84 KB
/
allTests.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
'use strict';
var testSuite = require('./test.js');
var fs = require('fs');
var argv = require('optimist').default('laxMode', false).default('browser', 'chrome').argv;
var rootUrl = 'http://localhost:8000/';
var frameworkNamePattern = /^[a-z-_]+$/;
var excludedFrameworks = [
// this implementation deviates from the specification to such an extent that they are
// not worth testing via a generic mechanism
'gwt',
// selenium webdriver cannot see the shadow dom
'polymer',
// these implementations cannot be run offline, because they are hosted
'derby', 'firebase-angular', 'meteor', 'socketstream',
// YUI is a special case here, it is not hosted, but fetches JS files dynamically
'yui',
// these frameworks take a long time to start-up, and there is no easy way to determine when they are ready
'cujo', 'montage',
// sammyjs fails intermittently, it would appear that its state is sometimes updated asynchronously?
'sammyjs',
// elm-html batches UI updates with requestAnimationFrame which the tests
// don't wait for
'elm',
// these are examples that have been removed or are empty folders
'emberjs_require', 'dermis'
];
// collect together the framework names from each of the subfolders
var list = fs.readdirSync('../examples/')
.map(function (folderName) {
return { name: folderName, path: 'examples/' + folderName };
});
// apps that are not hosted at the root of their folder need to be handled explicitly
var exceptions = [
{ name: 'chaplin-brunch', path: 'examples/chaplin-brunch/public' },
{ name: 'angular-dart', path: 'examples/angular-dart/web' },
{ name: 'duel', path: 'examples/duel/www' },
{ name: 'dart', path: 'examples/vanilladart/build/' },
{ name: 'canjs_require', path: 'examples/canjs_require/' },
{ name: 'troopjs', path: 'examples/troopjs_require/' },
{ name: 'thorax_lumbar', path: 'examples/thorax_lumbar/public' },
];
list = list.map(function (framework) {
var exception = exceptions.filter(function (exFramework) {
return exFramework.name === framework.name;
});
return exception.length > 0 ? exception[0] : framework;
});
// filter out any folders that are not frameworks (.e.g hidden files)
list = list.filter(function (framework) {
return frameworkNamePattern.test(framework.name);
});
// filter out un-supported implementations
list = list.filter(function (framework) {
return excludedFrameworks.indexOf(framework.name) === -1;
});
// if a specific framework has been named, just run this one
if (argv.framework) {
list = list.filter(function (framework) {
return framework.name === argv.framework;
});
if (list.length === 0) {
console.log('You have either requested an unknown or an un-supported framework');
}
}
// run the tests for each framework
list.forEach(function (framework) {
testSuite.todoMVCTest(
framework.name,
rootUrl + framework.path + '/index.html', argv.speedMode,
argv.laxMode, argv.browser);
});