git ssb

0+

cel-desktop / ssb-pkg



Tree: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44

Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test.js

1870 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const chalk = require('chalk');
6const globby = require('globby');
7const path = require('path');
8const utils = require('./utils.js');
9const host = 'node' + process.version.match(/^v(\d+)/)[1];
10let target = process.argv[2] || 'host';
11if (target === 'host') target = host;
12const flavor = process.argv[3] || 'all';
13
14console.log('');
15console.log('*************************************');
16console.log(target + ' ' + flavor);
17console.log('*************************************');
18console.log('');
19
20if (process.env.CI) {
21 if (target === 'node0' ||
22 target === 'node4' ||
23 target === 'node6' ||
24 target === 'node7' ||
25 target === 'node9' ||
26 target === 'node11' ||
27 target === 'node13') {
28 console.log(target + ' is skipped in CI!');
29 console.log('');
30 process.exit();
31 }
32}
33
34function joinAndForward (d) {
35 let r = path.join(__dirname, d);
36 if (process.platform === 'win32') r = r.replace(/\\/g, '/');
37 return r;
38}
39
40const list = [];
41
42if (flavor === 'only-npm') {
43 list.push(joinAndForward('test-79-npm/main.js'));
44} else {
45 list.push(joinAndForward('**/main.js'));
46 if (flavor === 'no-npm') {
47 list.push('!' + joinAndForward('test-42-fetch-all'));
48 list.push('!' + joinAndForward('test-46-multi-arch'));
49 list.push('!' + joinAndForward('test-46-multi-arch-2'));
50 list.push('!' + joinAndForward('test-79-npm'));
51 }
52}
53
54const files = globby.sync(list);
55
56files.sort().some(function (file) {
57 file = path.resolve(file);
58 try {
59 utils.spawn.sync(
60 'node', [ path.basename(file), target ],
61 { cwd: path.dirname(file), stdio: 'inherit' }
62 );
63 } catch (error) {
64 console.log();
65 console.log(`> ${chalk.red('Error!')} ${error.message}`);
66 console.log(`> ${chalk.red('Error!')} ${file} FAILED (in ${target})`);
67 process.exit(2);
68 }
69 console.log(file, 'ok');
70});
71

Built with git-ssb-web