UNPKG

1.06 kBJavaScriptView Raw
1'use strict'
2
3module.exports = {
4 command: 'test-dependant [repo]',
5 desc: 'Run the tests of an module that depends on this module to see if the current changes have caused a regression',
6 builder: {
7 repo: {
8 describe: 'The dependant module\'s repo URL',
9 type: 'string'
10 },
11 branch: {
12 describe: 'A branch to use from the dependant repo',
13 type: 'string'
14 },
15 moduleName: {
16 describe: 'A branch to use from the dependant repo',
17 type: 'string'
18 },
19 deps: {
20 describe: 'Other dependencies to override, e.g. --deps=foo@1.5.0,bar@2.4.1',
21 coerce: (val) => {
22 if (typeof val !== 'string') {
23 return {}
24 }
25
26 const deps = {}
27
28 for (const dep of val.split(',')) {
29 const parts = dep.split('@')
30 deps[parts[0]] = parts[1]
31 }
32
33 return deps
34 },
35 default: {}
36 }
37 },
38 handler (argv) {
39 const cmd = require('../src/test-dependant')
40 const onError = require('../src/error-handler')
41 cmd(argv).catch(onError)
42 }
43}