-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
tests.js
45 lines (37 loc) · 1.11 KB
/
tests.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
const meow = require('meow');
const colors = require('colors');
const getVersions = require('./_setup/getVersions.js');
const versionsRecursively = require('./_setup/versionsRecursively.js');
const program = require('./_setup/program');
const runTests = require('./_setup/runTests.js');
const cli = meow(`
Run tests on all Laravel versions
$ node tests.js
Run tests on given Laravel version
$ node tests.js {LaravelVersion}
Examples
$ node tests.js
$ node tests.js "7.*"
`, {
flags: {
verbose: {
type: 'boolean',
alias: 'v'
}
}
});
/**
* Runs tests for all versions or for specified version
*/
async function main () {
const currentDirectory = process.cwd()
const versions = getVersions(cli.input)
await versionsRecursively(versions, async function (version) {
const success = await runTests(version, currentDirectory, cli.flags.verbose);
if (success === false) {
throw Error('Tests failed')
}
})
console.log(colors.green('🎉 All tests passed'));
}
program(process, cli, 'Running tests for', main)