@suffolklitlab/alkiln 5.13.3-feat-random → 5.13.3-feat-random-2

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.
@@ -159,7 +159,9 @@ jobs:
159
159
  INSTALL_METHOD: "server"
160
160
  #### Developer note: You can probably leave the rest out
161
161
  #### To learn more, see https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#optional-inputs
162
- ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
162
+ #ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
163
+ # Temp debugging GitHub multi-folder problem
164
+ ALKILN_TAG_EXPRESSION: "@rp1"
163
165
  ALKILN_VERSION: random
164
166
 
165
167
  #### Developer note: Example of making an issue when tests fail
@@ -80,6 +80,8 @@ jobs:
80
80
  # Internal: docassemble changes sometimes break @a11y tests. That is
81
81
  # a da problem, not ours. We will trigger these tests manually when we
82
82
  # want to check up on this.
83
- ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
83
+ #ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
84
+ # Temp debugging GitHub multi-folder problem
85
+ ALKILN_TAG_EXPRESSION: "@rp1"
84
86
  #### Developer note: You can probably leave this out
85
87
  ALKILN_VERSION: random
@@ -27,7 +27,7 @@ jobs:
27
27
  - run: npm run unit
28
28
  # Artifacts
29
29
  - name: upload unit tests artifacts folder
30
- uses: actions/upload-artifact@v3
30
+ uses: actions/upload-artifact@v4
31
31
  # This will upload even if a previous step has failed
32
32
  if: ${{ always() }}
33
33
  with:
@@ -0,0 +1,75 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ function shift_logs(folderPath, startNum, endNum) {
5
+ // Validate inputs
6
+ if (!folderPath || typeof folderPath !== 'string') {
7
+ throw new Error('Invalid folder path provided');
8
+ }
9
+ if (!startNum || !endNum || isNaN(startNum) || isNaN(endNum)) {
10
+ throw new Error('Invalid number range provided');
11
+ }
12
+
13
+ // Process directory recursively
14
+ function processDirectory(dirPath) {
15
+ // Read all files in the folder
16
+ const files = fs.readdirSync(dirPath);
17
+
18
+ files.forEach(file => {
19
+ const some_path = path.join(dirPath, file);
20
+ const stats = fs.statSync(some_path);
21
+
22
+ if (stats.isDirectory()) {
23
+ // Recursively process subdirectories
24
+ processDirectory(some_path);
25
+ } else if (stats.isFile()) {
26
+ // Only process supported file paths
27
+ if ( some_path.startsWith(`.`) || some_path.startsWith(`alkiln`) || some_path.startsWith(`_`)) {
28
+ console.log(`not editing`, some_path);
29
+ return;
30
+ }
31
+ if (some_path.match(/(node_modules)|(_alkiln)|(package)|(shrinkwrap)|(runtime)|(alkiln\-)$/)) {
32
+ console.log(`not editing`, some_path);
33
+ return;
34
+ }
35
+
36
+ let content = fs.readFileSync(some_path, 'utf8');
37
+
38
+ // Create regex pattern for ALK followed by digits
39
+ const pattern = /\bALK0(\d+)\b/g;
40
+
41
+ // Process matches and adjust numbers
42
+ content = content.replace(pattern, (match, numStr) => {
43
+ console.log(`match in ${ some_path }:`, JSON.stringify(match) );
44
+
45
+ const num = parseInt(numStr);
46
+ // Only modify numbers within our target range
47
+ if (num >= startNum && num <= endNum) {
48
+ console.log(`Changing match: previous content:`);
49
+ console.log( content );
50
+ return `ALK0${num + 1}`;
51
+ }
52
+ return match;
53
+ });
54
+
55
+ // Write back the modified content
56
+ fs.writeFileSync(some_path, content);
57
+ console.log(`Processed file: ${file}`);
58
+ }
59
+ });
60
+ }
61
+
62
+ processDirectory(folderPath)
63
+ }
64
+
65
+ // Example usage
66
+ try {
67
+ shift_logs(`.`, 236, 276); //'./your_folder', 123, 456);
68
+ console.log('Sequence fixing completed');
69
+ } catch (error) {
70
+ console.error('Error:', error.message);
71
+ }
72
+
73
+
74
+ function check_types({ folderPath, startNum, endNum }) {
75
+ }
package/action.yml CHANGED
@@ -106,10 +106,10 @@ runs:
106
106
  run: |
107
107
  log="💡 ALK0024 INFO: Confirm environment variables"
108
108
  echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
109
- vars_log='\nALKiln version is $ALKILN_VERSION\nRepo is "$REPO_URL"\nBranch ref is "$BRANCH_PATH"\nCustom MAX_SECONDS_FOR_SETUP is "$MAX_SECONDS_FOR_SETUP"\nCustom SERVER_RELOAD_TIMEOUT_SECONDS is "$SERVER_RELOAD_TIMEOUT_SECONDS"\nCustom MAX_RANDOM_TESTS_PER_SCENARIO is "$MAX_RANDOM_TESTS_PER_SCENARIO"\n'
109
+ vars_log='\nALKiln version is ${{ env.ALKILN_VERSION }}\nRepo is "${{ env.REPO_URL }}"\nBranch ref is "${{ env.BRANCH_PATH }}"\nCustom MAX_SECONDS_FOR_SETUP is "${{ env.MAX_SECONDS_FOR_SETUP }}"\nCustom SERVER_RELOAD_TIMEOUT_SECONDS is "${{ env.SERVER_RELOAD_TIMEOUT_SECONDS }}"\nCustom MAX_RANDOM_TESTS_PER_SCENARIO is "${{ env.MAX_RANDOM_TESTS_PER_SCENARIO }}"\n'
110
110
  echo -e "$vars_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$vars_log"
111
111
 
112
- # Install ALKiln into GitHub workflow
112
+ # Install ALKiln during GitHub workflow
113
113
  - name: "💡 ALK0025 INFO: Set up node"
114
114
  uses: actions/setup-node@v4
115
115
  with:
@@ -122,19 +122,17 @@ runs:
122
122
  npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
123
123
 
124
124
  # Files prep
125
-
126
125
  - shell: bash
127
126
  env:
128
127
  ARTIFACT_FOLDER: ${{ env.ARTIFACT_FOLDER }}
129
128
  run: |
130
- log="💡 ALK0273 INFO: Prepare repository test files"
129
+ log="💡 ALK0275 INFO: Prepare repository test files"
131
130
  echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
132
131
  alkiln-artifacts --path="${{ env.ARTIFACT_FOLDER }}"
133
132
  alkiln-validate
134
133
  alkiln-generate
135
134
 
136
135
  # Install package on playground
137
-
138
136
  # Don't rely on the environment's version of python
139
137
  - uses: actions/setup-python@v5
140
138
  if: ${{ inputs.INSTALL_METHOD == 'playground' }}
@@ -156,15 +154,15 @@ runs:
156
154
  long_log="\n\n―――\n🤕 ALK0028 ERROR: Unable to create a Project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
157
155
  echo -e "$long_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$long_log"
158
156
 
159
- # Server installations - find folders and save session vars
160
- - name: "💡 ALK0029 INFO: Install the GitHub package onto the server"
157
+ # Server installation
158
+ - name: "💡 ALK0029 INFO: Try to install the GitHub package onto the GitHub sandbox server"
161
159
  if: ${{ inputs.INSTALL_METHOD == 'server' }}
162
160
  shell: bash
163
161
  run: |
164
162
  log="💡 ALK0029 INFO: Install the GitHub package onto the server"
165
163
  echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
166
164
  alkiln-server-install
167
- - name: "🤕 ALK0030 ERROR: Unable to install the package"
165
+ - name: "🤕 ALK0030 ERROR: Unable to install the package on the GitHub sandbox server"
168
166
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
169
167
  shell: bash
170
168
  run: |
@@ -51,36 +51,28 @@ runs:
51
51
  run: |
52
52
  log="💡 ALK0018 INFO: Get path names with date and time"
53
53
  timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
54
+ # Where to get the contents for the artifact
54
55
  debug_dir="/tmp"
55
- debug_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
56
+ debug_logs_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
57
+ # Where to put the artifact
56
58
  artifact_folder="alkiln_github_server-${timestamp}UTC"
59
+ echo "debug_logs_path: $debug_logs_path"
60
+ echo "artifact_folder: $artifact_folder"
57
61
 
58
62
  mkdir -p "$debug_dir"
59
63
  mkdir -p "$artifact_folder"
60
- echo -e "$log" >> "$debug_path"
64
+ echo -e "$log" >> "$debug_logs_path"
61
65
 
62
- echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
66
+ echo "DEBUG_LOGS_PATH=$debug_logs_path" >> $GITHUB_ENV
63
67
  echo "GITHUB_SERVER_ARTIFACT_NAME=$artifact_folder" >> $GITHUB_ENV
64
68
 
65
- - shell: bash
66
- env:
67
- GITHUB_SERVER_ARTIFACT_NAME: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
68
- run: |
69
- log="💡 ALK0276 INFO: Prepare repository test files"
70
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
71
- alkiln-artifacts --path="${{ env.GITHUB_SERVER_ARTIFACT_NAME }}"
72
- alkiln-validate
73
- alkiln-generate
74
-
75
- # These run twice. As before, this creates 2 artifact folders.
76
-
77
69
  - shell: bash
78
70
  env:
79
71
  MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
80
72
  DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
81
73
  run: |
82
74
  log="💡 ALK0001 INFO: Set environment variables"
83
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
75
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
84
76
 
85
77
  echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
86
78
  echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
@@ -93,7 +85,7 @@ runs:
93
85
  shell: bash
94
86
  run: |
95
87
  log="💡 ALK0002 INFO: Create GitHub step output variables"
96
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
88
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
97
89
  echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
98
90
  echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
99
91
  echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
@@ -104,19 +96,19 @@ runs:
104
96
  shell: bash
105
97
  run: |
106
98
  log="💡 ALK0003 INFO: Get config"
107
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
99
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
108
100
 
109
101
  mkdir /tmp/config
110
102
  # Worth making this silent by defining a variable with > /dev/null...?
111
103
  if [ -n "$CONFIG" ]
112
104
  then
113
105
  log2="💡 ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
114
- echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" echo "$log2"
106
+ echo -e "\n$log2" >> "${{ env.DEBUG_LOGS_PATH }}" echo "$log2"
115
107
  echo "$CONFIG" > /tmp/config/myconfig.yml
116
108
  echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
117
109
  else
118
110
  log3="💡 ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
119
- echo -e "\n$log3" >> "${{ env.DEBUG_PATH }}" echo "$log3"
111
+ echo -e "\n$log3" >> "${{ env.DEBUG_LOGS_PATH }}" echo "$log3"
120
112
  echo "CONFIG_ARGS=" >> $GITHUB_ENV
121
113
  fi
122
114
 
@@ -132,13 +124,13 @@ runs:
132
124
  shell: bash
133
125
  run: |
134
126
  log="💡 ALK0006 INFO: Determine docker logs visibility"
135
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
127
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
136
128
  if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
137
129
  echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
138
- echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.DEBUG_PATH }}"
130
+ echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.DEBUG_LOGS_PATH }}"
139
131
  else
140
132
  echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
141
- echo -e "\nfalse" >> "${{ env.DEBUG_PATH }}"
133
+ echo -e "\nfalse" >> "${{ env.DEBUG_LOGS_PATH }}"
142
134
  fi
143
135
 
144
136
  # Messages about output
@@ -148,14 +140,14 @@ runs:
148
140
  run: |
149
141
  # 💡 ALK0007 INFO: ALKiln will now hide docker output
150
142
  log="===\n💡 ALK0007 INFO: ALKiln will now hide docker output to avoid possibly showing details about your config. If you want to get output to see more of what is going on, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"true\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
151
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
143
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
152
144
  - name: "💡 ALK0008 INFO: ALKiln will show docker output"
153
145
  if: ${{ env.OUTPUT_DOCKER == 'true' }}
154
146
  shell: bash
155
147
  run: |
156
148
  # 💡 ALK0008 INFO: ALKiln will show docker output
157
149
  log="===\n💡 ALK0008 INFO: ALKiln will show docker output. ALKiln cannot control this output. If you want to prevent output, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"false\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
158
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
150
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
159
151
 
160
152
  # TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
161
153
  # No docker output
@@ -166,7 +158,7 @@ runs:
166
158
  shell: bash
167
159
  run: |
168
160
  log="💡 ALK0009 INFO: Download and start docker silently"
169
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
161
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
170
162
  docker pull jhpyle/docassemble > /dev/null 2>&1
171
163
  docker run --name docassemble_container \
172
164
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
@@ -183,7 +175,7 @@ runs:
183
175
  shell: bash
184
176
  run: |
185
177
  log="💡 ALK0010 INFO: Download and start docker"
186
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
178
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
187
179
  docker pull jhpyle/docassemble
188
180
  docker run --name docassemble_container \
189
181
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
@@ -201,13 +193,13 @@ runs:
201
193
  run: |
202
194
  # 💡 ALK0011 INFO: The following messages are not docker output
203
195
  log="💡 ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
204
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
196
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
205
197
 
206
198
  - name: "💡 ALK0012 INFO: Waiting for server to start"
207
199
  shell: bash
208
200
  run: |
209
201
  log="💡 ALK0012 INFO: Waiting for server to start"
210
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
202
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
211
203
 
212
204
  # Reset the SECONDS variable
213
205
  SECONDS=0
@@ -217,27 +209,27 @@ runs:
217
209
  response="start"
218
210
  while [[ $response != *"200"* ]]; do
219
211
  log2="💡 ALK0013 INFO: Time elapsed: $SECONDS seconds"
220
- echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" && echo -e "$log2"
212
+ echo -e "\n$log2" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log2"
221
213
 
222
214
  # Check if max seconds till loading has passed
223
215
  if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
224
216
  log3="🤕 ALK0014 ERROR: Timed out waiting for docker container to serve the site. If you want to give your docker container more timem to install, set the MAX_SECONDS_FOR_DOCKER input for this action."
225
- echo -e "\n$log3" >> "${{ env.DEBUG_PATH }}" && echo -e "$log3"
217
+ echo -e "\n$log3" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log3"
226
218
  exit 1
227
219
  fi
228
220
 
229
221
  # Set the variable to a new string value in each iteration
230
222
  response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
231
223
  log4="💡 ALK0015 INFO: Response is $response"
232
- echo -e "\n$log4" >> "${{ env.DEBUG_PATH }}" && echo -e "$log4"
224
+ echo -e "\n$log4" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log4"
233
225
 
234
226
  # Check if the string includes the desired text
235
227
  if [[ $response == *"200"* ]]; then
236
228
  log5="💡 ALK0016 SUCCESS: Success! The docker container is ready!"
237
- echo -e "\n$log5" >> "${{ env.DEBUG_PATH }}" && echo -e "$log5"
229
+ echo -e "\n$log5" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log5"
238
230
  else
239
231
  log6="💡 ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
240
- echo -e "\n$log6" >> "${{ env.DEBUG_PATH }}" && echo -e "$log6"
232
+ echo -e "\n$log6" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log6"
241
233
  sleep 30
242
234
  fi
243
235
 
@@ -272,23 +264,23 @@ runs:
272
264
  shell: bash
273
265
  run: |
274
266
  log="💡 ALK0019 INFO: Create docker artifact data"
275
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
276
- echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_PATH }}"
267
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
268
+ echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_LOGS_PATH }}"
277
269
  - name: "💡 ALK0020 INFO: Upload artifacts folder"
278
270
  if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
279
271
  uses: actions/upload-artifact@v4
280
272
  with:
281
273
  name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
282
- path: ${{ env.DEBUG_PATH }}
274
+ path: ${{ env.DEBUG_LOGS_PATH }}
283
275
 
284
276
  - shell: bash
285
277
  if: ${{ success() }}
286
278
  run: |
287
279
  log="💡 ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
288
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
280
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
289
281
 
290
282
  - shell: bash
291
283
  if: ${{ failure() }}
292
284
  run: |
293
285
  log="🤕 ALK0022 ERROR: Something went wrong. See above for more details."
294
- echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
286
+ echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // rename? install_authors_docassemble_interview_package_on_server
4
-
5
3
  const child_process = require(`child_process`);
6
4
 
7
5
  const Log = require(`../utils/Log`);
@@ -56,7 +54,7 @@ const setup = async () => {
56
54
  + `dainstall this package on your server. See above for more details.`;
57
55
  log.throw({ code: `ALK0047`, context,
58
56
  before: `☝️ ☝️ ☝️ Error data ☝️ ☝️ ☝️\n`,
59
- error: `Error while installing project` },
57
+ error: new Error(`Error while installing project on your docassemble server`) },
60
58
  install_err_msg
61
59
  );
62
60
  }
@@ -10,34 +10,29 @@ const Log = require('./utils/Log');
10
10
  const session_vars = require('./utils/session_vars');
11
11
  const set_sources_paths = require(`./utils/set_sources_paths`);
12
12
 
13
- // TODO: Remove after merging Log class
14
- const files = require('./utils/files');
15
-
16
13
  const SUMMARY_FILENAME = `cucumber-report.txt`;
17
14
 
18
15
 
19
- function build_config( cli_args ) {
16
+ function build_config() {
20
17
  /** Use the command line arguments to build the cucumberjs config object.
21
18
  *
22
19
  * @param {string?} - Arguments passed to the command line.
23
20
  *
24
21
  * @returns {object} - cucumberjs config object
25
22
  * */
26
- // ========== TODO: Abstract after merging Log class PR
27
23
  // Turn all the paths to the sources folders into paths to the feature files
28
24
  let sources_paths = session_vars.get_sources_paths();
29
25
  let feature_paths = [];
30
26
 
31
27
  // Get all the paths for the right feature files (for cucumber to use)
32
28
  for ( let sources_path of sources_paths ) {
33
- // Ignore feature files that we parsed ourselves
34
29
  let glob = fast_glob.sync(
35
30
  `${ sources_path }/**/*.feature`,
31
+ // Ignore "generator" feature files that we used to generate actual tests
36
32
  { ignore: [`${ sources_path }/${ globals.generators_prefix }*.feature`] }
37
33
  );
38
34
  feature_paths.push( ...glob );
39
35
  }
40
- // ========== Ends TODO: Abstract
41
36
 
42
37
  const config = {
43
38
  publishQuiet: true,
@@ -47,6 +42,7 @@ function build_config( cli_args ) {
47
42
  retry: 1,
48
43
  }
49
44
 
45
+ const cli_args = require(`minimist`)( process.argv.slice(2) );
50
46
  // Normalize tag expressions, if there are any
51
47
  // Joining and splitting handles both tags surrounded with `""` or those without `""`
52
48
  let tags = cli_args[`_`].join(` `).split(` `);
@@ -84,29 +80,11 @@ async function main() {
84
80
  environment
85
81
  );
86
82
 
87
- // ========== TODO: Abstract after merging Log class PR
88
- let artifacts_path = files.make_artifacts_folder();
89
- session_vars.save_artifacts_path_name( artifacts_path );
90
-
91
- // We'll use the user info to construct the possible paths to /sources
92
- let id = session_vars.get_user_id();
93
- // `project` is the name in the server docassemble "Project" page
94
- let project = session_vars.get_user_project_name();
95
-
96
- // process.argv is a list of strings of commands and args.
97
- // If using `npm run cucumber` (as opposed to the bin commands),
98
- // use `--` before `--sources=./foo`
99
- const argv = require(`minimist`)( process.argv.slice(2), {
100
- default: {
101
- sources: [
102
- `./docassemble/*/data/sources`, // In GitHub folder
103
- `/usr/share/docassemble/files/playgroundsources/${id}/${project}/*.feature`, // From playground without S3
104
- `/tmp/playgroundsources/${id}/${project}/*.feature` // From playground with S3
105
- ],
106
- }
107
- });
108
-
109
- // ========== Ends TODO: Abstract
83
+ // TODO: These are not used as far as I can tell. Delete them
84
+ // // We'll use the user info to construct the possible paths to /sources
85
+ // let id = session_vars.get_user_id();
86
+ // // `project` is the name in the server docassemble "Project" page
87
+ // let project = session_vars.get_user_project_name();
110
88
 
111
89
  const { runConfiguration } = await cucumber_api.loadConfiguration({
112
90
  provided: build_config( argv ),
@@ -133,9 +111,9 @@ async function main() {
133
111
 
134
112
  /** Write to files.
135
113
  *
136
- * Note: Don't add to the purely report-focused files. Those are files where
137
- * authors can focus on the info we give them, which they often miss in
138
- * the GitHub action.
114
+ * Note: Avoid adding to the purely report-focused files. Those are files
115
+ * where authors can focus on the info we give them, which they often miss
116
+ * in the GitHub action.
139
117
  */
140
118
 
141
119
  if ( success ) {
@@ -153,29 +131,12 @@ async function main() {
153
131
  const exitCode = success ? 0 : 50;
154
132
  process.exitCode = exitCode;
155
133
 
156
- /** TODO:
157
- * randomly generated test file cleanup
158
- * 1. Generate files into the sources folder
159
- * 2. copy the randomly generated files into the artifacts folder
160
- * 3. MVP: delete the randomly generated files from the sources folder
161
- * 4. post MVP: let the author keep the randomly generated tests in the
162
- * sources folder and make a PR with them
163
- * */
164
-
165
- /**
166
- * Loop through sources folders
167
- * If there are generated files in the generated files folder(s)
168
- * delete that folder from the sources folders where we found them
169
- * */
170
-
171
- // This is hardcoded information from `provide_config` above.
172
- // This code isn't used for anything other than detecting and removing color codes.
173
134
  let summary_file_name = SUMMARY_FILENAME;
174
135
  fs.readFile(summary_file_name, 'utf8', (read_error, text) => {
175
136
  if ( read_error ) {
176
137
  // Something else will probably show an error that's more relevant
177
138
  log.warn({ code: `ALK0056`, context: `post_run error`, },
178
- `Failed to read cucumber report`, read_error
139
+ `Failed to read the report of the 3rd party library, cucumberjs. There may be more information above or below.`, read_error
179
140
  );
180
141
  return;
181
142
  }
@@ -210,7 +171,13 @@ async function main() {
210
171
  try {
211
172
  fs.readFileSync(`${ log.path }/${ log.unexpected_filename }`); // Does it have contents?
212
173
  fs.appendFileSync(`${ log.path }/${ log.unexpected_filename }`, `\n\n\n\n\n` );
213
- } catch ( ignore_err ) { /* Missing unexpected file is ok */ }
174
+ } catch ( ignore_err ) {
175
+ /* Missing "unexpected results" file is ok */
176
+ }
177
+
178
+ // TODO: Is this meant to write to the debug file or is this debug info
179
+ // really supposed to be in the "unexpected results" file? Or are these
180
+ // comments old?
214
181
 
215
182
  // Add the heading for debug content
216
183
  fs.appendFileSync( `${ log.path }/${ log.unexpected_filename }`,
@@ -224,7 +191,7 @@ async function main() {
224
191
 
225
192
  } catch ( writing_cucumber_error ) {
226
193
  let code = `ALK0182`;
227
- let context = `post_run error`
194
+ let context = `post_run`
228
195
  let msg = `Something probably went wrong earlier. See warnings and errors above. Skipped writing to ${ log.path }/${ log.debug_log_filename }.`;
229
196
  try {
230
197
  log.warn({ code, context, }, msg, writing_cucumber_error );