-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
78 lines (68 loc) · 2.06 KB
/
test.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
/* istanbul instrument in package mysql-lite */
/*jslint
bitwise: true,
browser: true,
maxerr: 8,
maxlen: 96,
node: true,
nomen: true,
regexp: true,
stupid: true
*/
(function () {
'use strict';
var local;
// run shared js-env code - pre-init
(function () {
// init local
local = {};
// init modeJs
local.modeJs = 'node';
// init global
local.global = global;
switch (local.modeJs) {
// re-init local from example.js
case 'node':
local = global.local = (local.global.utility2_rollup || require('utility2'))
.requireExampleJsFromReadme();
break;
}
}());
switch (local.modeJs) {
// run node js-env code - function
case 'node':
local.testCase_build_doc = function (options, onError) {
/*
* this function will test build's doc handling-behavior
*/
options = {};
local.buildDoc(options, onError);
};
local.testCase_build_readme = function (options, onError) {
/*
* this function will test build's readme handling-behavior
*/
options = {};
options.readmeFile = local.fs.readFileSync('README.md', 'utf8');
options.readmeTemplate = local.templateReadme;
// search-and-replace readmeTemplate
[
(/ \[!\[istanbul coverage\].*?(\n)/),
(/\n# cdn download\n[\S\s]*(\n# documentation\n)/),
(/\n\| test-server-. : \|[\S\s]*?(\n\| build-artifacts : \|)/),
(/\n# quickstart\b[\S\s]*?(\n# package.json\n)/)
].forEach(function (rgx) {
options.readmeTemplate = options.readmeTemplate.replace(rgx, '$1');
});
local.buildReadmeJslintLite(options, onError);
};
break;
}
switch (local.modeJs) {
// run node js-env code - post-init
case 'node':
// run test-server
local.testRunServer(local);
break;
}
}());