testdriverai 4.0.41 → 4.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -0
- package/lib/config.js +14 -1
- package/lib/sdk.js +3 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,6 +61,16 @@ let getArgs = () => {
|
|
|
61
61
|
let command = 0;
|
|
62
62
|
let file = 1;
|
|
63
63
|
|
|
64
|
+
|
|
65
|
+
// TODO use a arg parser library to simplify this
|
|
66
|
+
if (args[command] == "--help" || args[command] == '-h'
|
|
67
|
+
|| args[file] == "--help" || args[file] == '-h') {
|
|
68
|
+
console.log(
|
|
69
|
+
"Command: testdriverai [init, run, edit] [yaml filepath]"
|
|
70
|
+
);
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
if (args[command] == 'init') {
|
|
65
75
|
} else if (args[command] !== 'run' && !args[file]) {
|
|
66
76
|
args[file] = args[command];
|
package/lib/config.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains application config.
|
|
3
|
+
* It is responsible for loading the config from env,
|
|
4
|
+
* supplying defaults, and formatting values
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Load the env vars from .env
|
|
1
8
|
require('dotenv').config()
|
|
2
9
|
|
|
3
10
|
// Parse out true and false string values
|
|
@@ -18,7 +25,9 @@ const config = {
|
|
|
18
25
|
TD_SPEAK: false,
|
|
19
26
|
TD_ANALYTICS: false,
|
|
20
27
|
TD_NOTIFY: false,
|
|
21
|
-
|
|
28
|
+
TD_API_ROOT: "https://replayable-api-production.herokuapp.com",
|
|
29
|
+
TD_DEV: parseValue(process.env['DEV']),
|
|
30
|
+
}
|
|
22
31
|
|
|
23
32
|
// Find all env vars starting with TD_
|
|
24
33
|
for (let key in process.env) {
|
|
@@ -27,4 +36,8 @@ for (let key in process.env) {
|
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
|
|
39
|
+
if (config.TD_DEV) {
|
|
40
|
+
console.info("Testdriverai config: ", config);
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
module.exports = config;
|
package/lib/sdk.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
// custom "sdk" for calling our API
|
|
3
|
-
let root = "https://replayable-api-production.herokuapp.com";
|
|
4
|
-
|
|
5
|
-
if (process.env['DEV']) {
|
|
6
|
-
root = "https://replayable-dev-ian-mac-m1-16.ngrok.io";
|
|
7
|
-
}
|
|
8
|
-
|
|
1
|
+
const config = require('./config');
|
|
9
2
|
const chalk = require('chalk');
|
|
10
3
|
const axios = require('axios');
|
|
11
4
|
const session = require('./session')
|
|
12
5
|
const package = require('../package.json');
|
|
13
6
|
const version = package.version;
|
|
14
7
|
|
|
8
|
+
const root = config["TD_API_ROOT"];
|
|
9
|
+
|
|
15
10
|
let token = null;
|
|
16
11
|
|
|
17
12
|
let outputError = (e) => {
|