-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
67 lines (63 loc) · 1.86 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
const chalk = require('chalk');
const shell = require('shelljs');
const defaultOptions = {
async: true,
env: {
...process.env,
FORCE_COLOR: 2,
}
};
const inAngular = {
cwd: './test/in-angular-material',
};
const inPlainHtmlJs = {
cwd: './test/in-plain-html-js',
};
const inTypescriptRequireJs = {
cwd: './test/in-typescript-requirejs',
};
function run(cmd, options = {}) {
return new Promise((resolve, reject) => {
shell.exec(cmd, { ...defaultOptions, ...options}, (error, stdout, stderr) => {
if (error > 0) {
reject({ code: error, stderr });
} else {
resolve(stdout);
}
})
})
}
function logPartHeader(title) {
const titleLine = '== ' + title + ' ==';
const hr = Array.from(titleLine).map(() => '=').join('');
// const log = (text) => console.log(text);
const log = (text) => console.log(chalk.bgGreen(chalk.bold(' ' + text + ' ')));
const emptyLine = () => console.log();
emptyLine();
emptyLine();
log(hr);
log(titleLine);
log(hr);
emptyLine();
}
Promise.resolve()
.then(() => run('npm i'))
.then(() => run('npm run build:all'))
// .then(() => logPartHeader('test in plain html js'))
// .then(() => run('npm i', inPlainHtmlJs))
// .then(() => run('npm run test:once', inPlainHtmlJs))
// .then(() => logPartHeader('test in typescript requirejs'))
// .then(() => run('npm i', inTypescriptRequireJs))
// .then(() => run('npm run coverage', inTypescriptRequireJs))
// .then(() => logPartHeader('test in angular material'))
.then(() => run('npm i', inAngular))
.then(() => run('npm run version', inAngular))
// .then(() => run('npm run coverage', inAngular))
.then(() => run('npm run e2e', inAngular))
.then(() => run('npm run build', inAngular))
.then(() => run('npm run test:build-result', inAngular))
.then(
() => process.exit(0),
(error) => process.exit(error.code)
)
;