UNPKG

1.32 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3var parseArgs = require('minimist'),
4 paramedic = require('./paramedic');
5
6var plugins,
7 platformId;
8
9var USAGE = "Error missing args. \n" +
10 "cordova-paramedic --platform PLATFORM --plugin PATH [--justbuild --timeout MSECS --port PORTNUM]" +
11 "`PLATFORM` : the platform id, currently only supports 'ios'\n" +
12 "`PATH` : the relative or absolute path to a plugin folder\n" +
13 "\texpected to have a 'tests' folder.\n" +
14 "\tYou may specify multiple --plugin flags and they will all\n" +
15 "\tbe installed and tested together.\n" +
16 "`MSECS` : (optional) time in millisecs to wait for tests to pass|fail \n" +
17 "\t(defaults to 10 minutes) \n" +
18 "`PORTNUM` : (optional) port to use for posting results from emulator back to paramedic server\n" +
19 "--justbuild : (optional) just builds the project, without running the tests";
20
21var argv = parseArgs(process.argv.slice(2));
22
23if(!argv.platform || !argv.plugin) {
24 console.log(USAGE);
25 process.exit(1);
26}
27
28var onComplete = function(resCode,resObj,logStr) {
29 console.log("result code is : " + resCode);
30 if(resObj) {
31 console.log(JSON.stringify(resObj));
32 }
33 if(logStr) {
34 console.log(logStr);
35 }
36 process.exit(resCode);
37};
38
39paramedic.run(argv.platform, argv.plugin, onComplete, argv.justbuild, argv.port, argv.timeout,false);
40