@suffolklitlab/alkiln 5.13.3-feat-random-2 → 5.13.3-feat-random-3
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/.github/workflows/github_server.yml +1 -3
- package/.github/workflows/playground.yml +1 -3
- package/CHANGELOG.md +28 -1
- package/lib/run_cucumber.js +0 -6
- package/lib/steps.js +1 -17
- package/lib/utils/Log.js +0 -10
- package/lib/utils/session_vars.js +0 -1
- package/package.json +1 -1
- package/_alkiln_meta/shift_logs.js +0 -75
|
@@ -159,9 +159,7 @@ 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
|
-
|
|
163
|
-
# Temp debugging GitHub multi-folder problem
|
|
164
|
-
ALKILN_TAG_EXPRESSION: "@rp1"
|
|
162
|
+
ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
|
|
165
163
|
ALKILN_VERSION: random
|
|
166
164
|
|
|
167
165
|
#### Developer note: Example of making an issue when tests fail
|
|
@@ -80,8 +80,6 @@ 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
|
-
|
|
84
|
-
# Temp debugging GitHub multi-folder problem
|
|
85
|
-
ALKILN_TAG_EXPRESSION: "@rp1"
|
|
83
|
+
ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
|
|
86
84
|
#### Developer note: You can probably leave this out
|
|
87
85
|
ALKILN_VERSION: random
|
package/CHANGELOG.md
CHANGED
|
@@ -43,7 +43,34 @@ Format:
|
|
|
43
43
|
-
|
|
44
44
|
-->
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
## [Unreleased]
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Add the `constrained random answers` Step. You must put the Step in a "constrained random test generator" Scenario which goes in a "constrained random test generator" file - a `.feature` file that starts with "alkiln_random". The file **MUST have ONLY 1 Scenario per generator file** at the moment. The Step is pretty strict. If there are irregularities, it will probably fail, but it will fail quickly. It is flexible about number of tests, though, and will default to 1. Closes [#962](https://github.com/SuffolkLITLab/ALKiln/issues/962).
|
|
51
|
+
- Add `MAX_RANDOM_TESTS_PER_SCENARIO` optional environment variable for the above `constrained random answers` Step. Default value is `40` until we hear otherwise.
|
|
52
|
+
- Regular tests that have incorrect syntax will fail more quickly now - very near the start. So will invalid "constrained random test generator" files. This will be a little slower for GitHub Sandbox tests right now, but still faster than it has been in the past. Closes [#972](https://github.com/SuffolkLITLab/ALKiln/issues/972).
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Improve report indentation and tweak styling.
|
|
57
|
+
- Clarify some logs, including addressing bite-sized issues like [#981](https://github.com/SuffolkLITLab/ALKiln/issues/981).
|
|
58
|
+
- The report now shows the name of every Step that gets run in a test.
|
|
59
|
+
|
|
60
|
+
### Internal
|
|
61
|
+
|
|
62
|
+
- Added: `lib/globals.js` file to hold some shared constant values across the framework. It should NOT manage state. We may want to change the name to `constants.js` or `global_contants.js`. Let's see how it serves us.
|
|
63
|
+
- Added: executable scripts for more setup steps - managing the artifacts path (at the start of a run) and validating and generating files.
|
|
64
|
+
- Changed: `Log` now prioritizes what folder it stores files in in this order:
|
|
65
|
+
1. Use the argument to use an existing folder and save that to runtime_config.json at root.
|
|
66
|
+
2. Use the argument to make a new folder with that name and save that to runtime_config.json at root.
|
|
67
|
+
3. Use the alread-existing folder name value in runtime_config.json at root
|
|
68
|
+
4. Create a new folder and save that to runtime_config.json at root
|
|
69
|
+
- Changed: Add `.error()` to `Log` for visual clarity when storing an error to throw later. We need to discuss this behavior and its return value. To make that work Logs can now get the `error` prop without throwing an error.
|
|
70
|
+
- Changed: the Story Table step now accepts multiple ids and stops at whatever id it reaches first. I highly recommend that only ALKiln generated tests use this feature. We may avoid documenting it unless authors ask for it.
|
|
71
|
+
- Changed: `.gitignore` and `.npmignore` more things
|
|
72
|
+
- Fixed: log codes checker obob.
|
|
73
|
+
- Fixed: updated `actions/upload-artifact@v3` to `actions/upload-artifact@v4`
|
|
47
74
|
|
|
48
75
|
## [5.13.4] - 2025-01-11
|
|
49
76
|
|
package/lib/run_cucumber.js
CHANGED
|
@@ -79,12 +79,6 @@ async function main() {
|
|
|
79
79
|
log.info({ code: `ALK0049`, context: `pre_run environment` },
|
|
80
80
|
environment
|
|
81
81
|
);
|
|
82
|
-
|
|
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();
|
|
88
82
|
|
|
89
83
|
const { runConfiguration } = await cucumber_api.loadConfiguration({
|
|
90
84
|
provided: build_config( argv ),
|
package/lib/steps.js
CHANGED
|
@@ -99,28 +99,12 @@ BeforeAll(async function() {
|
|
|
99
99
|
// Store path names for files and docs created for the tests
|
|
100
100
|
scope.paths = {};
|
|
101
101
|
|
|
102
|
-
// // Make the folder to store all the files for this run of the tests
|
|
103
|
-
// scope.paths.artifacts = files.make_artifacts_folder();
|
|
104
|
-
// // Save its name in a file. `session_vars` can get it back later.
|
|
105
|
-
// // The value we are saving is used by at least run_cucumber.js.
|
|
106
|
-
|
|
107
102
|
// A little indirect, but the artifacts path should always have already been
|
|
108
103
|
// created by now, either by `run_cucumber.js` or the relevant test
|
|
109
|
-
|
|
110
|
-
// // TODO: Is this causing the GitHub tests artifacts trouble? Because
|
|
111
|
-
// // `.get_artifacts_path_name()` is messing up somehow? That shouldn't be a
|
|
112
|
-
// // problem. That's the same method `Log` uses. Why does runtime_config not
|
|
113
|
-
// // have a value here?
|
|
114
|
-
// scope.paths.artifacts = session_vars.get_artifacts_path_name();
|
|
115
|
-
// log = new Log({ path: scope.paths.artifacts, context: `steps` });
|
|
116
|
-
|
|
117
|
-
console.log(`\n\n`, `scope.paths.artifacts:`, scope.paths.artifacts, `\n\n`);
|
|
118
|
-
// New attempt avoids passing in a path. For the record, this shouldn't help.
|
|
119
104
|
log = new Log({ context: `steps` });
|
|
120
105
|
scope.set_log({ log_obj: log });
|
|
121
106
|
|
|
122
107
|
scope.paths.artifacts = session_vars.get_artifacts_path_name();
|
|
123
|
-
|
|
124
108
|
scope.paths.debug_log = `${ scope.paths.artifacts }/${ log.debug_log_filename }`;
|
|
125
109
|
scope.paths.report_log = `${ scope.paths.artifacts }/${ log.report_log_filename }`;
|
|
126
110
|
scope.paths.report = `${ scope.paths.artifacts }/${ log.report_filename }`;
|
|
@@ -196,7 +180,7 @@ BeforeStep(async function ( step ) {
|
|
|
196
180
|
// start of a Step after it's been completed, as cucumber already does. Add
|
|
197
181
|
// a 'step' type and additional success/failure information, though that
|
|
198
182
|
// may be challenging.
|
|
199
|
-
reports.addToReport(scope, { type: `row
|
|
183
|
+
reports.addToReport(scope, { type: `row`, value: step.pickleStep.text });
|
|
200
184
|
reports.indent();
|
|
201
185
|
});
|
|
202
186
|
|
package/lib/utils/Log.js
CHANGED
|
@@ -147,8 +147,6 @@ class Log {
|
|
|
147
147
|
* const log = new Log({ path: "_alkiln-123", context: "setup" });
|
|
148
148
|
* */
|
|
149
149
|
|
|
150
|
-
console.trace(`\n\nCreating from Log`);
|
|
151
|
-
|
|
152
150
|
// These records help internal tests check for correct behavior
|
|
153
151
|
this.internal_log_records = [];
|
|
154
152
|
|
|
@@ -164,7 +162,6 @@ class Log {
|
|
|
164
162
|
if ( context ) { context = context + ` log`; }
|
|
165
163
|
else { context = `log`; }
|
|
166
164
|
let files_msg = `ALKiln will save test results files at "${ this.path }"`;
|
|
167
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. Calculated path:`, this.path);
|
|
168
165
|
if ( is_new_folder ) {
|
|
169
166
|
this.info({ code: `ALK0214`, context, }, files_msg );
|
|
170
167
|
} else {
|
|
@@ -220,30 +217,23 @@ class Log {
|
|
|
220
217
|
* */
|
|
221
218
|
try {
|
|
222
219
|
|
|
223
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. Given dir:`, dir);
|
|
224
|
-
|
|
225
220
|
// GitHub actions pass in a dir, but other processes, like
|
|
226
221
|
// ALKilnInThePlayground, don't have a path
|
|
227
222
|
if ( !dir ) {
|
|
228
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. No dir given`);
|
|
229
223
|
if ( session_vars.get_artifacts_path_name() ) {
|
|
230
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. Artifacts path already has a name`);
|
|
231
224
|
dir = session_vars.get_artifacts_path_name();
|
|
232
225
|
} else {
|
|
233
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. Making brand new artifacts path`);
|
|
234
226
|
dir = files.make_artifacts_folder();
|
|
235
227
|
}
|
|
236
228
|
}
|
|
237
229
|
|
|
238
230
|
if ( !fs.existsSync( dir )) {
|
|
239
|
-
console.log(`🐛🐛🐛🐛🐛 ALKTemp debugging Log path. Artifacts path dir doesn't yet exist`);
|
|
240
231
|
files.make_artifacts_folder( dir );
|
|
241
232
|
}
|
|
242
233
|
|
|
243
234
|
return { dir, errors: [] };
|
|
244
235
|
|
|
245
236
|
} catch ( error_making_dir ) {
|
|
246
|
-
// Logs should fail silently. With no dir, though, we can't save the error
|
|
247
237
|
return { dir, errors: [ error_making_dir ]};
|
|
248
238
|
}
|
|
249
239
|
|
|
@@ -280,7 +280,6 @@ session_vars.get_runtime_config_var = function ( key ) {
|
|
|
280
280
|
try {
|
|
281
281
|
let json = JSON.parse( fs.readFileSync( runtime_config_path ));
|
|
282
282
|
let value = json[ key ];
|
|
283
|
-
console.log(`🐛🐛🐛🐛🐛 ALK00temp config key/value pair:`, key, value);
|
|
284
283
|
if ( session_vars.get_debug() ) {
|
|
285
284
|
console.debug( `🐛 ALK0041 DEBUG: Runtime config var "${ key }" is "${ value }".` );
|
|
286
285
|
}
|
package/package.json
CHANGED
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
}
|