testilo 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. package/README.md +9 -1
  2. package/index.js +5 -4
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -9,6 +9,8 @@ This application is designed to be installed on a Windows or Macintosh host and
9
9
 
10
10
  ## Dependencies
11
11
 
12
+ The `dotenv` dependency lets you set environment variables in an untracked `.env` file.
13
+
12
14
  The Testaro dependency has some dependencies in the @siteimprove scope that are Github Packages. In order to execute `npm install` successfully, you need the `.npmrc` file in your project directory with this content, unless an `.npmrc` file in your home directory or elsewhere provides the same content:
13
15
 
14
16
  ```bash
@@ -76,10 +78,16 @@ Given that statement, Testilo replaces the hosts in the script with the first ho
76
78
 
77
79
  When you execute a `node index …` statement, Testilo begins populating the object argument by giving its `id` property a value. If there is no batch, the value of that property is a string encoding the date and time when you executed the statement (e.g., `eh9q7r`). If there is a batch, the value is the same, except that it is suffixed with a hyphen-minus character followed by the `id` value of the host (e.g., `eh9q7r-wikimedia`).
78
80
 
79
- Testaro delivers its results by populating the `log` and `acts` arrays of the object argument. Testilo waits for Testaro to finish performing the script and then saves the object argument in JSON format as a file in the `reports` directory.
81
+ Testaro delivers its results by populating the `log` and `acts` arrays of the object argument. Testilo waits for Testaro to finish performing the script and then saves the object argument in JSON format as a file in the `reports` directory. The name of the file is the `id` value of the object, suffixed with `.json`.
80
82
 
81
83
  ## Configuration
82
84
 
83
85
  ### `ibm` test
84
86
 
85
87
  Testaro can perform the `ibm` test. That test requires the `aceconfig.js` configuration file in the root directory of the Testilo project.
88
+
89
+ ### Environment variables
90
+
91
+ If a `wave` test is included in a script, an environment variable named `TESTARO_WAVE_KEY` must exist, with your WAVE API key as its value.
92
+
93
+ Before executing a Testaro script, you can optionally also set the environment variables `TESTARO_DEBUG` (to `'true'` or anything else) and/or `TESTARO_WAITS` (to a non-negative integer). The effects of these variables are described in the Testaro `index.js` file.
package/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  // ########## IMPORTS
7
7
 
8
8
  // Module to perform tests.
9
+ require('dotenv').config();
9
10
  const {handleRequest} = require('testaro');
10
11
  const fs = require('fs').promises;
11
12
 
@@ -44,16 +45,16 @@ const callTestaro = async (id, script) => {
44
45
  };
45
46
  // Runs a job.
46
47
  const run = async () => {
47
- const scriptName = process.argv[2];
48
+ const scriptID = process.argv[2];
48
49
  const batchName = process.argv[3];
49
- if (scriptName) {
50
+ if (scriptID) {
50
51
  try {
51
- const scriptJSON = await fs.readFile(`scripts/${scriptName}.json`, 'utf8');
52
+ const scriptJSON = await fs.readFile(`scripts/${scriptID}.json`, 'utf8');
52
53
  const script = JSON.parse(scriptJSON);
53
- let batch = null;
54
54
  // Identify the start time and a timestamp.
55
55
  const timeStamp = Math.floor((Date.now() - Date.UTC(2022, 1)) / 2000).toString(36);
56
56
  // If there is a batch:
57
+ let batch = null;
57
58
  if (batchName) {
58
59
  // Convert the script to a batch-based set of scripts.
59
60
  const batchJSON = await fs.readFile(`batches/${batchName}.json`, 'utf8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Client that runs Testaro tests to fulfill Aorta jobs",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "homepage": "https://github.com/jrpool/testilo",
20
20
  "dependencies": {
21
+ "dotenv": "*",
21
22
  "testaro": "*"
22
23
  },
23
24
  "devDependencies": {