@suffolklitlab/alkiln 5.13.2 → 5.13.3-feat-random

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 (49) hide show
  1. package/.github/workflows/github_server.yml +7 -7
  2. package/.github/workflows/playground.yml +2 -1
  3. package/CHANGELOG.md +32 -1
  4. package/action.yml +89 -29
  5. package/action_for_github_server/action.yml +73 -29
  6. package/docs/4_environments.md +243 -0
  7. package/docs/artifacts_folder_name.md +135 -0
  8. package/docs/constrained_random_tests.md +254 -0
  9. package/docs/decisions/006_which_log_level_to_pick_2024_09_5.md +70 -0
  10. package/docs/decisions/007_getting_and_storing_logs.md +179 -0
  11. package/docs/decisions/move_runtime_config_to_sources_folder.md +5 -0
  12. package/docs/decisions/reports_and_logs_2024_08_11.md +161 -0
  13. package/docs/kinds_of_errors.md +26 -0
  14. package/docs/prioritize_constrained_random_tests.md +60 -0
  15. package/lib/docassemble/docassemble_api_interface.js +77 -51
  16. package/lib/docassemble/server_install.js +32 -9
  17. package/lib/docassemble/setup.js +41 -24
  18. package/lib/docassemble/takedown.js +33 -10
  19. package/lib/globals.js +10 -0
  20. package/lib/run_cucumber.js +155 -50
  21. package/lib/scope.js +101 -77
  22. package/lib/setup/TestGenerator.js +1745 -0
  23. package/lib/setup/artifacts.js +20 -0
  24. package/lib/setup/generate.js +42 -0
  25. package/lib/setup/get_Gherkin_AST.js +26 -0
  26. package/lib/setup/validate.js +89 -0
  27. package/lib/steps.js +176 -51
  28. package/lib/utils/Log.js +1132 -0
  29. package/lib/utils/_alkiln-constrained_random_tests_old.js +1727 -0
  30. package/lib/utils/files.js +18 -11
  31. package/lib/utils/get_error_stacks.js +16 -0
  32. package/lib/utils/reports.js +95 -28
  33. package/lib/utils/session_vars.js +102 -73
  34. package/lib/utils/set_sources_paths.js +98 -0
  35. package/lib/utils/time.js +44 -0
  36. package/package.json +16 -8
  37. package/tests/log_codes/check_codes.sh +19 -14
  38. package/tests/log_codes/log_code_expected_instances.txt +69 -9
  39. package/tests/unit_tests/constrained_random_answers/invalid.fixtures.js +155 -0
  40. package/tests/unit_tests/constrained_random_answers/invalid.test.js +233 -0
  41. package/tests/unit_tests/constrained_random_answers/valid.fixtures.js +905 -0
  42. package/tests/unit_tests/constrained_random_answers/valid.test.js +521 -0
  43. package/tests/unit_tests/example_of_chai_test_lifecycle.js +78 -0
  44. package/tests/unit_tests/getAllFields.test.js +5 -0
  45. package/tests/unit_tests/getMatchingRows.test.js +5 -0
  46. package/tests/unit_tests/log.test.js +557 -0
  47. package/tests/unit_tests/normalizeTable.test.js +5 -0
  48. package/lib/utils/log.js +0 -96
  49. /package/docs/{expected_inernal_results.md → expected_internal_results.md} +0 -0
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.13.2",
3
+ "version": "5.13.3-feat-random",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
- "test": "npm run unit && npm run codes && npm run cucumber",
8
- "cucumber": "./lib/run_cucumber.js",
9
- "local": "npm run setup && npm run cucumber; npm run takedown",
10
- "pass": "npm run cucumber 'not @error and not @temp_error'",
11
- "fail": "npm run cucumber '@error'",
7
+ "test": "npm run build && npm run unit && npm run codes && npm run cucumber",
8
+ "local": "npm run build && npm run setup && npm run cucumber; npm run takedown",
9
+ "pass": "npm run build && ./lib/run_cucumber.js 'not @error and not @temp_error'",
10
+ "fail": "npm run build && npm run cucumber '@error'",
11
+ "cucumber": "npm run build && ./lib/run_cucumber.js",
12
12
  "setup": "./lib/docassemble/setup.js",
13
13
  "takedown": "./lib/docassemble/takedown.js",
14
14
  "server_install": "./lib/docassemble/server_install.js",
15
- "unit": "mocha tests/unit_tests/*.test.*",
15
+ "build": "npm run artifacts && npm run files",
16
+ "files": "npm run validate && npm run generate",
17
+ "validate": "./lib/setup/validate.js",
18
+ "generate": "./lib/setup/generate.js",
19
+ "unit": "npm run artifacts && mocha --recursive 'tests/unit_tests/**/*.test.*'",
20
+ "artifacts": "./lib/setup/artifacts.js",
16
21
  "codes": "tests/log_codes/check_codes.sh ."
17
22
  },
18
23
  "repository": {
@@ -57,6 +62,9 @@
57
62
  "alkiln-server-install": "./lib/docassemble/server_install.js",
58
63
  "alkiln-setup": "./lib/docassemble/setup.js",
59
64
  "alkiln-takedown": "./lib/docassemble/takedown.js",
60
- "alkiln-run": "./lib/run_cucumber.js"
65
+ "alkiln-run": "./lib/run_cucumber.js",
66
+ "alkiln-artifacts": "./lib/setup/artifacts.js",
67
+ "alkiln-validate": "./lib/setup/validate.js",
68
+ "alkiln-generate": "./lib/setup/generate.js"
61
69
  }
62
70
  }
@@ -11,12 +11,13 @@ exit_code=0
11
11
 
12
12
  echo " -------------------------------------------------------
13
13
  | Usage: |
14
- | bash $(basename $0) [dir] [c file] [c folder] [-l arg]
14
+ | bash $(basename $0) [dir] [c file] [c folder] |
15
15
  | dir: The directory in which to search for logs |
16
16
  | c file: Name of the log instance counter file |
17
17
  | c folder: Path to the folder of the log counter file |
18
- | -l arg: \"1\" prints extra logs |
19
18
  -------------------------------------------------------"
19
+ # | bash $(basename $0) [dir] [c file] [c folder] [-l arg]
20
+ # | -l arg: \"1\" prints extra logs |
20
21
 
21
22
  # Get flags and their values
22
23
  loudness="0"
@@ -55,7 +56,8 @@ fi
55
56
 
56
57
  # removed and are no longer used. Syntax used works with GitHub cli - [[:digit:]]
57
58
  # https://stackoverflow.com/a/6901221
58
- instances=$(find "$where_to_look" -type f ! -name "check_codes.sh" ! -name "CONTRIBUTING.md" ! -name "$expected_instances_file" ! -name "debug_log.txt" ! -name "cucumber-report.txt" ! -path "*/node_modules/*" ! -path "*/ALKilnTests/*" ! -path "*/alkiln-*/*" ! -path "*/_alkiln*/*" -print0 | xargs -0 -P 4 grep -0 -ro 'ALK[[:digit:]][[:digit:]][[:digit:]][[:digit:]]' | grep -v -- '--' )
59
+ # Exclude files and paths
60
+ instances=$(find "$where_to_look" -type f ! -name "CONTRIBUTING.md" ! -name "$expected_instances_file" ! -name "debug_log.txt" ! -name "cucumber-report.txt" ! -name "_alkiln*" ! -path "*/tests/*" ! -path "*/node_modules/*" ! -path "*/ALKilnTests/*" ! -path "*/alkiln-*/*" ! -path "*/_alkiln*/*" ! -path "*/docs/*" ! -path "*/\.*" -print0 | xargs -0 -P 4 grep -0 -ro 'ALK[[:digit:]][[:digit:]][[:digit:]][[:digit:]]' | grep -v -- '--' )
59
61
 
60
62
  if [[ "$loudness" != "0" ]]; then
61
63
  total_instances=$(echo "$instances" | wc -l)
@@ -100,7 +102,7 @@ fi
100
102
  indx=0
101
103
  too_many=()
102
104
  missing=()
103
- while [ "$indx" -lt "$highest_code" ]; do
105
+ while [ "$indx" -le "$highest_code" ]; do
104
106
  # Turn the index into a log code by prepending ALK and adding leading zeros
105
107
  log_code=$(printf "ALK%04d" "$indx")
106
108
  # Count ";" - a stand-in for the number of
@@ -125,24 +127,27 @@ while [ "$indx" -lt "$highest_code" ]; do
125
127
  # To add to the list of strings to print later
126
128
  short_msg="$log_code $num_paths/$num_expected"
127
129
  long_msg="$log_code act/exp "
128
- long_msg+="$num_paths/$num_expected:"
130
+ long_msg+="$num_paths/$num_expected"
131
+ if [ "$num_paths" -gt "$num_expected" ]; then
132
+ long_msg+=":"
133
+ fi
129
134
  long_msg+=$(echo "${codes_unique_paths[$indx]}" | sed 's/;/\n - /g')
130
135
 
131
136
  # missing
132
137
  if [ "$num_paths" -lt "$num_expected" ]; then
133
- if [[ "$loudness" != "0" ]]; then
138
+ # if [[ "$loudness" != "0" ]]; then
134
139
  missing+=("$long_msg")
135
- else
136
- missing+=("$short_msg")
137
- fi
140
+ # else
141
+ # missing+=("$short_msg")
142
+ # fi
138
143
 
139
144
  # too_many
140
145
  elif [ "$num_paths" -gt "$num_expected" ]; then
141
- if [[ "$loudness" != "0" ]]; then
146
+ # if [[ "$loudness" != "0" ]]; then
142
147
  too_many+=("$long_msg")
143
- else
144
- too_many+=("$short_msg")
145
- fi
148
+ # else
149
+ # too_many+=("$short_msg")
150
+ # fi
146
151
  fi
147
152
 
148
153
  let indx++
@@ -190,4 +195,4 @@ else
190
195
  fi
191
196
 
192
197
 
193
- exit $exit_code
198
+ exit $exit_code
@@ -4,7 +4,11 @@ Why we need duplicate codes sometimes: GitHub actions sometimes don't have ways
4
4
 
5
5
  The script that tests the log codes will ignore this file (or any file with this name), and any file with these names: check_codes.sh, debug_log.txt, cucumber-report.txt. It will also ignore files in folders with these names:, node_modules, ALKilnTests, alkiln-*, _alkiln*. That list might get updated, so for an up-to-date list, always check the file check_codes.sh where we use `--exclude=` and such.
6
6
 
7
- ALK0000:8
7
+ Reasons for deletion:
8
+ 0053 - duplicate log
9
+ 0173 - redundant
10
+
11
+ ALK0000:0
8
12
  ALK0001:1
9
13
  ALK0002:2
10
14
  ALK0003:2
@@ -22,7 +26,7 @@ ALK0014:1
22
26
  ALK0015:1
23
27
  ALK0016:1
24
28
  ALK0017:1
25
- ALK0018:2
29
+ ALK0018:1
26
30
  ALK0019:2
27
31
  ALK0020:1
28
32
  ALK0021:1
@@ -33,10 +37,10 @@ ALK0025:1
33
37
  ALK0026:2
34
38
  ALK0027:2
35
39
  ALK0028:3
36
- ALK0029:1
40
+ ALK0029:2
37
41
  ALK0030:2
38
- ALK0031:1
39
- ALK0032:1
42
+ ALK0031:2
43
+ ALK0032:2
40
44
  ALK0033:1
41
45
  ALK0034:1
42
46
  ALK0035:1
@@ -57,7 +61,7 @@ ALK0049:1
57
61
  ALK0050:1
58
62
  ALK0051:1
59
63
  ALK0052:1
60
- ALK0053:1
64
+ ALK0053:0
61
65
  ALK0054:1
62
66
  ALK0055:1
63
67
  ALK0056:1
@@ -177,7 +181,7 @@ ALK0169:1
177
181
  ALK0170:1
178
182
  ALK0171:1
179
183
  ALK0172:1
180
- ALK0173:1
184
+ ALK0173:0
181
185
  ALK0174:1
182
186
  ALK0175:1
183
187
  ALK0176:1
@@ -185,7 +189,7 @@ ALK0177:1
185
189
  ALK0178:1
186
190
  ALK0179:1
187
191
  ALK0180:1
188
- ALK0181:1
192
+ ALK0181:0
189
193
  ALK0182:1
190
194
  ALK0183:1
191
195
  ALK0184:2
@@ -206,4 +210,60 @@ ALK0198:1
206
210
  ALK0199:1
207
211
  ALK0200:1
208
212
  ALK0201:1
209
- ALK0202:1
213
+ ALK0202:1
214
+ ALK0203:1
215
+ ALK0204:1
216
+ ALK0205:1
217
+ ALK0206:1
218
+ ALK0207:1
219
+ ALK0208:1
220
+ ALK0209:1
221
+ ALK0210:1
222
+ ALK0211:1
223
+ ALK0212:1
224
+ ALK0213:1
225
+ ALK0214:1
226
+ ALK0215:1
227
+ ALK0216:1
228
+ ALK0217:1
229
+ ALK0218:1
230
+ ALK0219:1
231
+ ALK0220:1
232
+ ALK0221:1
233
+ ALK0222:1
234
+ ALK0223:0 "Only logs that throw should give a value to \`error\`. Skipping the value."
235
+ ALK0224:1
236
+ ALK0225:1
237
+ ALK0226:1
238
+ ALK0227:1
239
+ ALK0228:1
240
+ ALK0229:1
241
+ ALK0230:1
242
+ ALK0231:1
243
+ ALK0232:1
244
+ ALK0233:1
245
+ ALK0234:1
246
+ ALK0235:1
247
+ ALK0236:1
248
+ ALK0237:1
249
+ ALK0238:1
250
+ ALK0239:1
251
+ ALK0240:1
252
+ ALK0241:1
253
+ ALK0242:1
254
+ ALK0243:1
255
+ ALK0244:1
256
+ ALK0245:1
257
+ ALK0246:1
258
+ ALK0247:1
259
+ ALK0248:1
260
+ ALK0249:1
261
+ ALK0250:1
262
+ ALK0251:1
263
+ ALK0252:1
264
+ ALK0253:1
265
+ ALK0254:1
266
+ ALK0255:1
267
+ ALK0256:1
268
+ ALK0257:1
269
+ ALK0258:1
@@ -0,0 +1,155 @@
1
+ /** Actual and expected values for INvalid constrained random answer tests. */
2
+
3
+ module.exports = fixts = {};
4
+
5
+ /** Research notes
6
+ *
7
+ * Valid: A feature is valid without a description
8
+ * Valid: A scenario is valid without a description
9
+ *
10
+ * TODO
11
+ * Research: Can we get back null or undefined without syntax errors? (unlikely)
12
+ * Research: Can feature.children[0] exist without a `.scenario` prop? (unlikely)
13
+ * */
14
+
15
+ fixts.generator_missing_Feature = {};
16
+ fixts.generator_missing_Feature.arg = `Scenario: Invalid feature file`;
17
+ fixts.generator_missing_Feature.expected = null;
18
+ fixts.generator_missing_Feature.error_codes = [ `ALK0232` ];
19
+ fixts.generator_missing_Feature.log_codes = [ `ALK0232` ];
20
+
21
+ fixts.generator_missing_contents = {};
22
+ fixts.generator_missing_contents.arg = ``;
23
+ fixts.generator_missing_contents.expected = null;
24
+ fixts.generator_missing_contents.error_codes = [ `ALK0233` ];
25
+ fixts.generator_missing_contents.log_codes = [ `ALK0233` ];
26
+
27
+ fixts.generator_0_Scenarios = {};
28
+ fixts.generator_0_Scenarios.arg = `Feature: No scenarios`;
29
+ fixts.generator_0_Scenarios.expected = null;
30
+ fixts.generator_0_Scenarios.error_codes = [ `ALK0235` ];
31
+ fixts.generator_0_Scenarios.log_codes = [ `ALK0235` ];
32
+
33
+
34
+ /**
35
+ * Missing fore_Step keywords
36
+ * Missing constraints Step keywords
37
+ * */
38
+
39
+ fixts.missing_fore_Step_keywords = {};
40
+ fixts.missing_fore_Step_keywords.arg =
41
+ `Feature: I generate constrained random tests
42
+
43
+ Scenario: I fail with missing keywords for a fore Step
44
+ Given ALKiln makes 2
45
+ Given the final Scenario status should be "failed"
46
+ Given I start the interview at "test_kickout"
47
+ And ALKiln tests get to "end" with:
48
+ | var | possible_values |
49
+ | user_choice | correct;; wrong |
50
+ `;
51
+ fixts.missing_fore_Step_keywords.expected = null;
52
+ fixts.missing_fore_Step_keywords.error_codes = [ `ALK0241`, `ALK0261` ];
53
+ fixts.missing_fore_Step_keywords.log_codes = [
54
+ `ALK0236`,
55
+ `ALK0241`,
56
+ `ALK0261`,
57
+ ];
58
+
59
+
60
+ fixts.missing_constraints_Step_keywords = {};
61
+ fixts.missing_constraints_Step_keywords.arg =
62
+ `Feature: I generate constrained random tests
63
+
64
+ Scenario: I fail with missing keywords for a constraints Step
65
+ Given ALKiln makes 2 constrained random answers tests
66
+ Given the final Scenario status should be "failed"
67
+ Given I start the interview at "test_kickout"
68
+ And tests get to "end" with:
69
+ | var | possible_values |
70
+ | user_choice | correct;; wrong |
71
+ `;
72
+ fixts.missing_constraints_Step_keywords.expected = null;
73
+ fixts.missing_constraints_Step_keywords.error_codes = [ `ALK0254`, `ALK0261` ];
74
+ fixts.missing_constraints_Step_keywords.log_codes = [
75
+ `ALK0236`, `ALK0242`, `ALK0243`,
76
+ `ALK0244`, `ALK0247`, `ALK0248`,
77
+ `ALK0254`,
78
+ `ALK0261`,
79
+ ];
80
+
81
+
82
+ fixts.missing_table = {};
83
+ fixts.missing_table.arg =
84
+ `Feature: I generate constrained random tests
85
+
86
+ Scenario: I fail with the first missing table
87
+ Given ALKiln makes 2 constrained random answers tests
88
+ Given the final Scenario status should be "failed"
89
+ Given I start the interview at "test_kickout"
90
+ And ALKiln tests get to "end" with:
91
+ And ALKiln tests get to "end" with:
92
+ `;
93
+ // ======= ENDS ARG ======= //
94
+ fixts.missing_table.expected = null;
95
+ fixts.missing_table.error_codes = [ `ALK0250`, `ALK0261` ];
96
+ fixts.missing_table.log_codes = [
97
+ `ALK0236`, `ALK0242`, `ALK0243`,
98
+ `ALK0244`, `ALK0247`, `ALK0248`, `ALK0245`,
99
+ `ALK0250`,
100
+ `ALK0261`,
101
+ ];
102
+
103
+
104
+ fixts.missing_ids = {};
105
+ fixts.missing_ids.arg =
106
+ `Feature: I generate constrained random tests
107
+
108
+ Scenario: I fail with missing quoted ids in constrained random answers
109
+ Given ALKiln makes 2 constrained random answers tests
110
+ Given the final Scenario status should be "failed"
111
+ Given I start the interview at "test_kickout"
112
+ And ALKiln will get to end with:
113
+ | var | possible_values |
114
+ | user_choice | correct;; wrong |
115
+ `;
116
+ // ======= ENDS ARG ======= //
117
+ fixts.missing_ids.expected = null;
118
+ fixts.missing_ids.error_codes = [ `ALK0249`, `ALK0261` ];
119
+ fixts.missing_ids.log_codes = [
120
+ `ALK0236`, `ALK0242`, `ALK0243`,
121
+ `ALK0244`, `ALK0247`, `ALK0248`, `ALK0245`,
122
+ `ALK0249`,
123
+ `ALK0261`,
124
+ ];
125
+
126
+
127
+ // A valid generator Scenario, but an erroring test when run in cucumber, so it
128
+ // will error here instead
129
+ fixts.only_row_is_header = {};
130
+ fixts.only_row_is_header.arg =
131
+ `Feature: I generate constrained random tests
132
+
133
+ Scenario: Non-table row after table header
134
+ Given ALKiln makes 2 constrained random answers tests
135
+ Given the final Scenario status should be "failed"
136
+ Given I start the interview at "test_kickout"
137
+ And ALKiln will get to "end" with:
138
+ | var | possible_values |
139
+ Then non-table line
140
+ | user_choice | correct;; wrong |
141
+ `;
142
+ fixts.only_row_is_header.expected = null;
143
+ fixts.only_row_is_header.error_codes = [`ALK0251`, `ALK0261`];
144
+ fixts.only_row_is_header.log_codes = [
145
+ `ALK0236`, `ALK0242`, `ALK0243`,
146
+ `ALK0244`, `ALK0247`, `ALK0248`, `ALK0245`,
147
+ `ALK0251`,
148
+ `ALK0261`,
149
+ ];
150
+
151
+ /**
152
+ * No test for a table interrupted in the middle of regular rows (the parser
153
+ * can't detect it)
154
+ * */
155
+
@@ -0,0 +1,233 @@
1
+ const chai = require(`chai`);
2
+ const expect = chai.expect;
3
+
4
+ const TestGenerator = require(`../../../lib/setup/TestGenerator.js`);
5
+ const Log = require(`../../../lib/utils/Log.js`);
6
+ const fixtures = require(`./invalid.fixtures.js`);
7
+
8
+
9
+ function get_error_codes({ errors }) {
10
+ /** Returns a list of ALKiln ALK#### codes from Error stacks
11
+ *
12
+ * @param {object} obj - Named arguments
13
+ * @param {[Error]} obj.errors - List of Error instances
14
+ *
15
+ * @returns {[str]} - List of ALKiln log codes in the errors
16
+ * */
17
+ let codes = [];
18
+ for ( let error of errors ) {
19
+ let matches = error.stack.match(/ALK\d\d\d\d/gm);
20
+ if ( matches ) {
21
+ codes.push( ...matches );
22
+ }
23
+ }
24
+
25
+ return codes;
26
+ };
27
+
28
+
29
+ function get_log_codes({ logger }) {
30
+ /** Returns a list of ALKiln codes from arguments sent to a Log instance
31
+ *
32
+ * @params {object} obj - Named arguments
33
+ * @params {Log} obj.logger - An instance of Log
34
+ * @params {object} obj.logger.opts - Options passed to the Log instance
35
+ * @params {str} obj.logger.opts.code - ALK#### formatted log code
36
+ * @params {[str]} obj.logger.logs - Additional messages to be logged
37
+ *
38
+ * @returns {[str]} - List of ALKiln log codes in the collection of logs
39
+ * */
40
+ let codes = [];
41
+
42
+ for ( let record of logger.internal_tests_records ) {
43
+ codes.push( record.opts.code );
44
+ }
45
+
46
+ return codes;
47
+ }
48
+
49
+ /** Variables that will change their values for each `it()` */
50
+ const logger = new Log({ context: `invalid generators unit tests` });
51
+ let fixture = null;
52
+ let new_contents = null;
53
+ let errors = null;
54
+ let actual = null;
55
+ function mutate_globals_with({ testing_vals }) {
56
+ /** Set up values for parsing, parse, record values. Mutates in-scope
57
+ * variables in a way that helps chaijs (mocha really) get the right
58
+ * values to the right places.
59
+ *
60
+ * @params {object} testing_vals - Arguments to pass to the function and
61
+ * expected values
62
+ *
63
+ * @returns {undefined}
64
+ * */
65
+ // Resets logger
66
+ logger.internal_tests_records = [];
67
+
68
+ // Fresh namespace
69
+ let generator = new TestGenerator();
70
+ // Mutates `fixture`
71
+ fixture = testing_vals;
72
+ // Mutates `new_contents` and `error`
73
+ ({ new_contents, errors } = generator.parse_file({
74
+ file_text: fixture.arg,
75
+ generator_path: `used_in_warning_logs`,
76
+ logger
77
+ }) );
78
+ };
79
+
80
+ describe(`Constrained random answers parser,`, function () {
81
+
82
+ describe(`when given a missing Feature keyword`, function () {
83
+
84
+ before(function () { mutate_globals_with({ testing_vals: fixtures.generator_missing_Feature }); });
85
+
86
+ let outer = fixtures.generator_missing_Feature;
87
+
88
+ it(`returns \`null\` for contents value`, function () {
89
+ expect( new_contents ).to.equal( fixture.expected );
90
+ });
91
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
92
+ expect( get_error_codes({ errors: errors }) )
93
+ .to.have.all.members( fixture.error_codes );
94
+ });
95
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
96
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
97
+ });
98
+
99
+ });
100
+
101
+ describe(`when given a empty generator text`, function () {
102
+
103
+ before(function () { mutate_globals_with({ testing_vals: fixtures.generator_missing_contents }); });
104
+
105
+ let outer = fixtures.generator_missing_contents;
106
+
107
+ it(`returns \`null\` for contents value`, function () {
108
+ expect( new_contents ).to.equal( fixture.expected );
109
+ });
110
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
111
+ expect( get_error_codes({ errors: errors }) )
112
+ .to.have.all.members( fixture.error_codes );
113
+ });
114
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
115
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
116
+ });
117
+
118
+ });
119
+
120
+ describe(`when given generator text missing Scenarios`, function () {
121
+
122
+ before(function () { mutate_globals_with({ testing_vals: fixtures.generator_0_Scenarios }); });
123
+
124
+ let outer = fixtures.generator_0_Scenarios;
125
+
126
+ it(`returns \`null\` for contents value`, function () {
127
+ expect( new_contents ).to.equal( fixture.expected );
128
+ });
129
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
130
+ expect( get_error_codes({ errors: errors }) )
131
+ .to.have.all.members( fixture.error_codes );
132
+ });
133
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
134
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
135
+ });
136
+
137
+ });
138
+
139
+ describe(`when given an invalid generator Scenario`, function () {
140
+
141
+ describe(`where a num tests fore Step is missing keywords,`, function () {
142
+
143
+ before(function () { mutate_globals_with({ testing_vals: fixtures.missing_fore_Step_keywords }); });
144
+
145
+ let outer = fixtures.missing_fore_Step_keywords;
146
+
147
+ it(`returns \`null\` for contents value`, function () {
148
+ expect( new_contents ).to.equal( fixture.expected );
149
+ });
150
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
151
+ expect( get_error_codes({ errors: errors }) ).to.have.all.members( fixture.error_codes );
152
+ });
153
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
154
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
155
+ });
156
+
157
+ });
158
+
159
+ describe(`where a constraints Step is missing keywords,`, function () {
160
+
161
+ before(function () { mutate_globals_with({ testing_vals: fixtures.missing_constraints_Step_keywords }); });
162
+
163
+ let outer = fixtures.missing_constraints_Step_keywords;
164
+
165
+ it(`returns \`null\` for contents value`, function () {
166
+ expect( new_contents ).to.equal( fixture.expected );
167
+ });
168
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
169
+ expect( get_error_codes({ errors: errors }) ).to.have.all.members( fixture.error_codes );
170
+ });
171
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
172
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
173
+ });
174
+
175
+ });
176
+
177
+ describe(`that is missing a table,`, function () {
178
+
179
+ before(function () { mutate_globals_with({ testing_vals: fixtures.missing_table }); });
180
+
181
+ let outer = fixtures.missing_table;
182
+
183
+ it(`returns \`null\` for contents value`, function () {
184
+ expect( new_contents ).to.equal( fixture.expected );
185
+ });
186
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
187
+ expect( get_error_codes({ errors: errors }) ).to.have.all.members( fixture.error_codes );
188
+ });
189
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
190
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
191
+ });
192
+
193
+ });
194
+
195
+ describe(`that has no quoted ids,`, function () {
196
+
197
+ before(function () { mutate_globals_with({ testing_vals: fixtures.missing_ids }); });
198
+
199
+ let outer = fixtures.missing_ids;
200
+
201
+ it(`returns \`null\` for contents value`, function () {
202
+ expect( new_contents ).to.equal( fixture.expected );
203
+ });
204
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
205
+ expect( get_error_codes({ errors: errors }) ).to.have.all.members( fixture.error_codes );
206
+ });
207
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
208
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
209
+ });
210
+
211
+ });
212
+
213
+ describe(`that has no header row,`, function () {
214
+
215
+ before(function () { mutate_globals_with({ testing_vals: fixtures.only_row_is_header }); });
216
+
217
+ let outer = fixtures.only_row_is_header;
218
+
219
+ it(`returns \`null\` for contents value`, function () {
220
+ expect( new_contents ).to.equal( fixture.expected );
221
+ });
222
+ it(`has these exact error codes: ${ JSON.stringify( outer.error_codes )}`, function () {
223
+ expect( get_error_codes({ errors: errors }) ).to.have.all.members( fixture.error_codes );
224
+ });
225
+ it(`has these exact _log_ codes: ${ JSON.stringify( outer.log_codes )}`, function () {
226
+ expect( get_log_codes({ logger }) ).to.have.all.members( fixture.log_codes );
227
+ });
228
+
229
+ });
230
+
231
+ });
232
+
233
+ });