pagean 4.4.2 → 6.0.1

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 (96) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -9
  3. package/docs/upgrade-guide.md +16 -0
  4. package/index.js +7 -4
  5. package/lib/config.js +2 -2
  6. package/lib/default-config.json +41 -39
  7. package/lib/externalFileUtils.js +1 -1
  8. package/lib/linkUtils.js +162 -25
  9. package/lib/logger.js +1 -1
  10. package/lib/report-template.handlebars +224 -209
  11. package/lib/schemaErrors.js +5 -4
  12. package/lib/testUtils.js +1 -1
  13. package/lib/tests.js +14 -14
  14. package/package.json +28 -30
  15. package/schemas/pageanrc.schema.json +199 -191
  16. package/.codeclimate.json +0 -8
  17. package/.depcheckrc.json +0 -3
  18. package/.dockerignore +0 -12
  19. package/.eslintrc.json +0 -19
  20. package/.gitattributes +0 -4
  21. package/.gitlab/gitlab-releaser.json +0 -16
  22. package/.htmlhintrc +0 -25
  23. package/.markdownlint.json +0 -13
  24. package/.pa11yci.json +0 -5
  25. package/.pageanrc.json +0 -55
  26. package/.stylelintrc.json +0 -7
  27. package/CHANGELOG.md +0 -204
  28. package/gitlab.pageanrc.json +0 -16
  29. package/jest.config.json +0 -22
  30. package/static-server.pageanrc.json +0 -50
  31. package/tests/__snapshots__/config.test.js.snap +0 -591
  32. package/tests/__snapshots__/externalFileUtils.test.js.snap +0 -7
  33. package/tests/__snapshots__/index.test.js.snap +0 -30
  34. package/tests/__snapshots__/pagean.test.js.snap +0 -82
  35. package/tests/__snapshots__/pageanrc.test.js.snap +0 -759
  36. package/tests/__snapshots__/reporter.test.js.snap +0 -509
  37. package/tests/config.test.js +0 -264
  38. package/tests/externalFileUtils.test.js +0 -184
  39. package/tests/index.test.js +0 -181
  40. package/tests/linkUtils.test.js +0 -290
  41. package/tests/logger.test.js +0 -324
  42. package/tests/pagean.test.js +0 -85
  43. package/tests/pageanrc.test.js +0 -96
  44. package/tests/reporter.test.js +0 -82
  45. package/tests/schemaErrors.test.js +0 -88
  46. package/tests/test-cases/.htmlhintrc +0 -25
  47. package/tests/test-cases/brokenLinks.html +0 -22
  48. package/tests/test-cases/consoleLog.html +0 -11
  49. package/tests/test-cases/duplicateLinks.html +0 -22
  50. package/tests/test-cases/dynamicContent.html +0 -13
  51. package/tests/test-cases/externalScripts.html +0 -21
  52. package/tests/test-cases/horizontalScrollbar.html +0 -13
  53. package/tests/test-cases/htmlError.html +0 -11
  54. package/tests/test-cases/noExternalScripts.html +0 -12
  55. package/tests/test-cases/notDocumentLinks.html +0 -18
  56. package/tests/test-cases/pagean-results.json +0 -1
  57. package/tests/test-cases/scriptError404.html +0 -9
  58. package/tests/test-cases/slowLoad.html +0 -9
  59. package/tests/test-configs/cli-tests/.pageanrc.json +0 -28
  60. package/tests/test-configs/cli-tests/all-empty.pageanrc.json +0 -10
  61. package/tests/test-configs/cli-tests/all-errors.pageanrc.json +0 -69
  62. package/tests/test-configs/cli-tests/all-fail-cli.pageanrc.json +0 -9
  63. package/tests/test-configs/cli-tests/no-urls.pageanrc.json +0 -7
  64. package/tests/test-configs/cli-tests/pass-fail-cli.pageanrc.json +0 -14
  65. package/tests/test-configs/integration-tests/all-passing-tests.pageanrc.json +0 -63
  66. package/tests/test-configs/integration-tests/broken-links-error.pageanrc.json +0 -22
  67. package/tests/test-configs/integration-tests/console-error-reporter-cli-json.pageanrc.json +0 -20
  68. package/tests/test-configs/integration-tests/console-error-reporter-html.pageanrc.json +0 -19
  69. package/tests/test-configs/integration-tests/console-error.pageanrc.json +0 -16
  70. package/tests/test-configs/integration-tests/console-output.pageanrc.json +0 -16
  71. package/tests/test-configs/integration-tests/external-scripts-error.pageanrc.json +0 -19
  72. package/tests/test-configs/integration-tests/horizontal-scrollbar.pageanrc.json +0 -16
  73. package/tests/test-configs/integration-tests/html-error.pageanrc.json +0 -16
  74. package/tests/test-configs/integration-tests/page-load-time.pageanrc.json +0 -16
  75. package/tests/test-configs/unit-tests/empty-url-values.pageanrc.json +0 -9
  76. package/tests/test-configs/unit-tests/empty-urls.pageanrc.json +0 -3
  77. package/tests/test-configs/unit-tests/empty.pageanrc.json +0 -2
  78. package/tests/test-configs/unit-tests/global-and-test-specific-settings-shorthand.pageanrc.json +0 -30
  79. package/tests/test-configs/unit-tests/global-and-test-specific-settings-test-props.pageanrc.json +0 -42
  80. package/tests/test-configs/unit-tests/global-and-test-specific-settings.pageanrc.json +0 -34
  81. package/tests/test-configs/unit-tests/global-test-settings.pageanrc.json +0 -15
  82. package/tests/test-configs/unit-tests/htmlhintrc-invalid.pageanrc.json +0 -7
  83. package/tests/test-configs/unit-tests/htmlhintrc-valid.pageanrc.json +0 -7
  84. package/tests/test-configs/unit-tests/ignored-links-denormalized.pageanrc.json +0 -18
  85. package/tests/test-configs/unit-tests/invalid.pageanrc.json +0 -0
  86. package/tests/test-configs/unit-tests/no-test-settings.pageanrc.json +0 -6
  87. package/tests/test-configs/unit-tests/project-no-test-settings.pageanrc.json +0 -7
  88. package/tests/test-configs/unit-tests/puppeteer-no-test-settings.pageanrc.json +0 -9
  89. package/tests/test-configs/unit-tests/reporters-empty.pageanrc.json +0 -7
  90. package/tests/test-configs/unit-tests/reporters-invalid-type.pageanrc.json +0 -9
  91. package/tests/test-configs/unit-tests/reporters-not-array.pageanrc.json +0 -6
  92. package/tests/test-configs/unit-tests/reporters-valid.pageanrc.json +0 -9
  93. package/tests/test-configs/unit-tests/test-specific-settings.pageanrc.json +0 -26
  94. package/tests/test-configs/unit-tests/url-types.pageanrc.json +0 -10
  95. package/tests/testUtils.test.js +0 -244
  96. package/tests/tests.test.js +0 -533
@@ -2,217 +2,232 @@
2
2
  <html lang="en">
3
3
 
4
4
  <head>
5
- <title>Pagean Results</title>
6
- <style>
7
- html {
8
- margin: 0;
9
- padding: 0;
10
- }
11
-
12
- body {
13
- color: #333333;
14
- font-family: Arial, Helvetica, sans-serif;
15
- font-size: 0.85rem;
16
- padding: 1rem;
17
- margin: auto;
18
- max-width: 1000px;
19
- }
20
-
21
- ul {
22
- margin: 0;
23
- margin-block: 0;
24
- margin-inline: 0;
25
- padding: 0;
26
- padding-inline: 0;
27
- }
28
-
29
- li {
30
- list-style: none;
31
- }
32
-
33
- h1 {
34
- margin-block: 0;
35
- margin-inline: 0;
36
- margin: 1rem 0 0.75rem 0;
37
- }
38
-
39
- h2 {
40
- font-size: 1rem;
41
- }
42
-
43
- .project,
44
- .started {
45
- margin: 0;
46
- padding-bottom: 0.5rem;
47
- }
48
-
49
- .test-summary {
50
- display: flex;
51
- flex-direction: row;
52
- margin-bottom: 2rem;
53
- max-width: 50%;
54
- }
55
-
56
- .summary {
57
- background-color: #f4f4f4;
58
- border: 1px solid #333333;
59
- display: inline-block;
60
- flex: 1 1 10%;
61
- margin: 0 0.25rem;
62
- padding: 0.25rem 0.5rem;
63
- }
64
-
65
- .summary:first-of-type {
66
- margin-left: 0;
67
- }
68
-
69
- .summary:last-of-type {
70
- margin-right: 0;
71
- }
72
-
73
- .passed {
74
- background-color: #dff2bf;
75
- border: 1px solid #44760f;
76
- color: #44760f;
77
- }
78
-
79
- .failed {
80
- background-color: #ffbaba;
81
- border: 1px solid #ad000c;
82
- color: #ad000c;
83
- }
84
-
85
- .warning {
86
- background-color: #fdec96;
87
- border: 1px solid #7e6902;
88
- color: #7e6902;
89
- }
90
-
91
- .test-results h2 {
92
- margin-block-end: 0;
93
- margin-block-start: 1rem;
94
- }
95
-
96
- summary {
97
- cursor: pointer;
98
- list-style: none;
99
- }
100
-
101
- summary::-webkit-details-marker {
102
- display: none;
103
- }
104
-
105
- li.test {
106
- margin: 0.25rem 0;
107
- padding: 0.5rem 1rem;
108
- }
109
-
110
- .test .header {
111
- display: flex;
112
- flex-direction: row;
113
- }
114
-
115
- .test .header .name {
116
- flex: 1 1 75%;
117
- }
118
-
119
- .test .header .result {
120
- flex: 1 1 25%;
121
- text-align: right;
122
- }
123
-
124
- .test .data,
125
- .test .time,
126
- .test .error {
127
- padding-left: 10px;
128
- }
129
-
130
- .test .data h3 {
131
- font-size: inherit;
132
- font-weight: normal;
133
- margin: 0.25rem 0 0 0;
134
- margin-block: 0;
135
- }
136
-
137
- .test .data li {
138
- background-color: inherit;
139
- border-style: none;
140
- padding: 0.25rem;
141
- }
142
-
143
- .test .data li:hover {
144
- background-color: rgba(255, 255, 255, 0.1);
145
- border: 1px dotted;
146
- border-right: 4px solid;
147
- padding: calc(0.25rem - 1px);
148
- }
149
-
150
- .test .data pre {
151
- margin: 0 0 0.25rem 0;
152
- }
153
-
154
- .test .time {
155
- margin: 0.25rem 0 0 0;
156
- }
157
- </style>
5
+ <title>Pagean Results</title>
6
+ <style>
7
+ html {
8
+ margin: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ body {
13
+ color: #333333;
14
+ font-family: Arial, Helvetica, sans-serif;
15
+ font-size: 0.85rem;
16
+ padding: 1rem;
17
+ margin: auto;
18
+ max-width: 1000px;
19
+ }
20
+
21
+ ul {
22
+ margin: 0;
23
+ margin-block: 0;
24
+ margin-inline: 0;
25
+ padding: 0;
26
+ padding-inline: 0;
27
+ }
28
+
29
+ li {
30
+ list-style: none;
31
+ }
32
+
33
+ h1 {
34
+ margin-block: 0;
35
+ margin-inline: 0;
36
+ margin: 1rem 0 0.75rem;
37
+ }
38
+
39
+ h2 {
40
+ font-size: 1rem;
41
+ }
42
+
43
+ .pre {
44
+ font-family: monospace;
45
+ white-space: pre-wrap;
46
+ }
47
+
48
+ .project,
49
+ .started {
50
+ margin: 0;
51
+ padding-bottom: 0.5rem;
52
+ }
53
+
54
+ .test-summary {
55
+ display: flex;
56
+ flex-direction: row;
57
+ margin-bottom: 2rem;
58
+ max-width: 50%;
59
+ }
60
+
61
+ .summary {
62
+ background-color: #f4f4f4;
63
+ border: 1px solid #333333;
64
+ display: inline-block;
65
+ flex: 1 1 10%;
66
+ margin: 0 0.25rem;
67
+ padding: 0.25rem 0.5rem;
68
+ }
69
+
70
+ .summary:first-of-type {
71
+ margin-left: 0;
72
+ }
73
+
74
+ .summary:last-of-type {
75
+ margin-right: 0;
76
+ }
77
+
78
+ .passed {
79
+ background-color: #dff2bf;
80
+ border: 1px solid #44760f;
81
+ color: #44760f;
82
+ }
83
+
84
+ .failed {
85
+ background-color: #ffbaba;
86
+ border: 1px solid #ad000c;
87
+ color: #ad000c;
88
+ }
89
+
90
+ .warning {
91
+ background-color: #fdec96;
92
+ border: 1px solid #7e6902;
93
+ color: #7e6902;
94
+ }
95
+
96
+ .test-results h2 {
97
+ margin-block-end: 0;
98
+ margin-block-start: 1rem;
99
+ }
100
+
101
+ details summary .name::after {
102
+ content: " ⏵";
103
+ }
104
+
105
+ details[open] summary .name::after {
106
+ content: " ⏷";
107
+ }
108
+
109
+ summary {
110
+ cursor: pointer;
111
+ list-style: none;
112
+ }
113
+
114
+ summary::-webkit-details-marker {
115
+ display: none;
116
+ }
117
+
118
+ li.test {
119
+ margin: 0.25rem 0;
120
+ padding: 0.5rem 1rem;
121
+ }
122
+
123
+ .test .header {
124
+ display: flex;
125
+ flex-direction: row;
126
+ }
127
+
128
+ .test .header .name {
129
+ flex: 1 1 75%;
130
+ }
131
+
132
+ .test .header .result {
133
+ flex: 1 1 25%;
134
+ text-align: right;
135
+ }
136
+
137
+ .test .data,
138
+ .test .time,
139
+ .test .error {
140
+ padding-left: 10px;
141
+ }
142
+
143
+ .test .data h3 {
144
+ font-size: inherit;
145
+ font-weight: normal;
146
+ margin: 0.25rem 0 0;
147
+ margin-block: 0;
148
+ }
149
+
150
+ .test .data li {
151
+ background-color: inherit;
152
+ border-style: none;
153
+ padding: 0.25rem;
154
+ }
155
+
156
+ .test .data li:hover {
157
+ background-color: rgba(255 255 255 / 10%);
158
+ border: 1px dotted;
159
+ border-right: 4px solid;
160
+ padding: calc(0.25rem - 1px);
161
+ }
162
+
163
+ .test .data .pre {
164
+ margin: 0 0 0.25rem;
165
+ }
166
+
167
+ .test .time {
168
+ margin: 0.25rem 0 0;
169
+ }
170
+ </style>
158
171
  </head>
159
172
 
160
173
  <body>
161
- <header>
162
- <h1 id="title">Pagean Results</h1>
163
- </header>
164
- <main>
165
- <h2 class="project">Project: {{project}}</h2>
166
- <section class="started">Started: {{executionStart}}</section>
167
- <section class="test-summary">
168
- <div class="summary">URLs: {{results.length}}</div>
169
- <div class="summary">Tests: {{summary.tests}}</div>
170
- <div class="summary passed">Passed: {{summary.passed}}</div>
171
- <div class="summary warning">Warning: {{summary.warning}}</div>
172
- <div class="summary failed">Failed: {{summary.failed}}</div>
173
- </section>
174
- <section class="test-results">
175
- {{#results}}
176
- <h2>URL: {{url}}</h2>
177
- <ul class="tests">
178
- {{#tests}}
179
- <li class="test {{result}}">
180
- {{#if data}}
181
- <details>
182
- <summary class="header">
183
- <div class="name">{{name}} ⏷</div>
184
- <div class="result">{{result}}</div>
185
- </summary>
186
- {{#if data.length}}
187
- <div class="data">
188
- <h3>Messages:</h3>
189
- <ul>
190
- {{#each data}}
191
- <li><pre>{{json .}}</pre></li>
192
- {{/each}}
193
- </ul>
194
- </div>
195
- {{else if data.pageLoadTime}}
196
- <div class="time">Load time: {{data.pageLoadTime}}s</div>
197
- {{else if data.error}}
198
- <div class="error">
199
- <h3>Error:</h3>
200
- <pre>{{json data.error}}</pre>
201
- </div>
202
- {{/if}}
203
- </details>
204
- {{else}}
205
- <div class="header">
206
- <div class="name">{{name}}</div>
207
- <div class="result">{{result}}</div>
208
- </div>
209
- {{/if}}
210
- </li>
211
- {{/tests}}
212
- </ul>
213
- {{/results}}
214
- </section>
215
- </main>
174
+ <header>
175
+ <h1 id="title">Pagean Results</h1>
176
+ </header>
177
+ <main>
178
+ <h2 class="project">Project: {{project}}</h2>
179
+ <section class="started">Started: {{executionStart}}</section>
180
+ <section class="test-summary">
181
+ <div class="summary">URLs: {{results.length}}</div>
182
+ <div class="summary">Tests: {{summary.tests}}</div>
183
+ <div class="summary passed">Passed: {{summary.passed}}</div>
184
+ <div class="summary warning">Warning: {{summary.warning}}</div>
185
+ <div class="summary failed">Failed: {{summary.failed}}</div>
186
+ </section>
187
+ <section class="test-results">
188
+ {{#results}}
189
+ <h2>URL: {{url}}</h2>
190
+ <ul class="tests">
191
+ {{#tests}}
192
+ <li class="test {{result}}">
193
+ {{#if data}}
194
+ <details>
195
+ <summary class="header">
196
+ <div class="name">{{name}}</div>
197
+ <div class="result">{{result}}</div>
198
+ </summary>
199
+ {{#if data.length}}
200
+ <div class="data">
201
+ <h3>Messages:</h3>
202
+ <ul>
203
+ {{#each data}}
204
+ <li>
205
+ <div class="pre">{{json .}}</div>
206
+ </li>
207
+ {{/each}}
208
+ </ul>
209
+ </div>
210
+ {{else if data.pageLoadTime}}
211
+ <div class="time">Load time: {{data.pageLoadTime}}s</div>
212
+ {{else if data.error}}
213
+ <div class="error">
214
+ <h3>Error:</h3>
215
+ <div class="pre">{{json data.error}}</div>
216
+ </div>
217
+ {{/if}}
218
+ </details>
219
+ {{else}}
220
+ <div class="header">
221
+ <div class="name">{{name}}</div>
222
+ <div class="result">{{result}}</div>
223
+ </div>
224
+ {{/if}}
225
+ </li>
226
+ {{/tests}}
227
+ </ul>
228
+ {{/results}}
229
+ </section>
230
+ </main>
216
231
  </body>
217
232
 
218
- </html>
233
+ </html>
@@ -2,17 +2,18 @@
2
2
 
3
3
  const { red } = require('kleur');
4
4
 
5
- const getDataKey = (dataPath) => {
5
+ const getDataKey = (instancePath) => {
6
6
  const baseKey = '<pageanrc>';
7
7
  // Special handling for empty pointer or root element
8
- if (!dataPath || dataPath === '/') {
8
+ if (!instancePath || instancePath === '/') {
9
9
  return baseKey;
10
10
  }
11
11
  // Convert pointer to key be splitting by /, removing first value (since pointer
12
12
  // starts with /, so empty), unencoding values, and the re-assembling with different
13
13
  // formatting for numeric array indices versus properties.
14
- return baseKey + dataPath.split('/').slice(1).reduce((accumulator, currentValue) => {
14
+ return baseKey + instancePath.split('/').slice(1).reduce((accumulator, currentValue) => {
15
15
  const unencodedValue = currentValue.replace(/~0/g, '~').replace(/~1/g, '/');
16
+ // eslint-disable-next-line sonarjs/no-nested-template-literals -- less intuitive
16
17
  return `${accumulator}${isNaN(unencodedValue) ? `.${unencodedValue}` : `[${unencodedValue}]`}`;
17
18
  }, '');
18
19
  };
@@ -31,7 +32,7 @@ const formatErrors = (errors) => {
31
32
  const margin = 2;
32
33
  let maxLength = 0;
33
34
  errors.forEach(error => {
34
- error.dataKey = getDataKey(error.dataPath);
35
+ error.dataKey = getDataKey(error.instancePath);
35
36
  error.formattedMessage = processErrorParams(error);
36
37
  // Get max dataKey length for all errors to line up column in final output
37
38
  if (error.dataKey.length > maxLength) {
package/lib/testUtils.js CHANGED
@@ -15,7 +15,7 @@ const getTestSettings = (testSettingProperty, urlSettings) => {
15
15
 
16
16
  // Allow cognitive complexity les than 10
17
17
  // eslint-disable-next-line sonarjs/cognitive-complexity
18
- const pageanTest = async(name, testFunction, testContext, testSettingProperty) => {
18
+ const pageanTest = async (name, testFunction, testContext, testSettingProperty) => {
19
19
  const testSettings = getTestSettings(testSettingProperty, testContext.urlSettings);
20
20
  testContext.testSettings = testSettings;
21
21
  if (testSettings.enabled) {
package/lib/tests.js CHANGED
@@ -4,13 +4,13 @@ const { HTMLHint } = require('htmlhint');
4
4
 
5
5
  const { testResultStates, pageanTest } = require('./testUtils');
6
6
  const fileUtils = require('./externalFileUtils');
7
- const linkUtils = require('./linkUtils');
7
+ const { isFailedResponse } = require('./linkUtils');
8
8
 
9
9
  const msPerSec = 1000;
10
10
 
11
- const horizontalScrollbarTest = async(context) => {
11
+ const horizontalScrollbarTest = async (context) => {
12
12
  // eslint-disable-next-line no-shadow -- less intuitive
13
- await pageanTest('should not have a horizontal scrollbar', async(context) => {
13
+ await pageanTest('should not have a horizontal scrollbar', async (context) => {
14
14
  // istanbul ignore next: injects script causing puppeteer error, see #48
15
15
  const scrollbar = await context.page.evaluate(() => {
16
16
  document.scrollingElement.scrollLeft = 1;
@@ -45,9 +45,9 @@ const consoleErrorTest = (context) => {
45
45
  }, context, 'consoleErrorTest');
46
46
  };
47
47
 
48
- const renderedHtmlTest = async(context) => {
48
+ const renderedHtmlTest = async (context) => {
49
49
  // eslint-disable-next-line no-shadow -- less intuitive
50
- await pageanTest('should have valid rendered HTML', async(context) => {
50
+ await pageanTest('should have valid rendered HTML', async (context) => {
51
51
  const html = await context.page.content();
52
52
  const lintResults = HTMLHint.verify(html, context.urlSettings.htmlHintConfig);
53
53
  const testResult = { result: lintResults.length === 0 ? testResultStates.passed : testResultStates.failed };
@@ -58,10 +58,10 @@ const renderedHtmlTest = async(context) => {
58
58
  }, context, 'renderedHtmlTest');
59
59
  };
60
60
 
61
- const pageLoadTimeTest = async(context) => {
61
+ const pageLoadTimeTest = async (context) => {
62
62
  const testSettingName = 'pageLoadTimeTest';
63
63
  // eslint-disable-next-line no-shadow -- less intuitive
64
- await pageanTest('should load page within timeout', async(context) => {
64
+ await pageanTest('should load page within timeout', async (context) => {
65
65
  const { pageLoadTimeThreshold } = context.testSettings;
66
66
  const name = `should load page within ${pageLoadTimeThreshold} sec`;
67
67
  // istanbul ignore next: injects script causing puppeteer error, see #48
@@ -77,9 +77,9 @@ const pageLoadTimeTest = async(context) => {
77
77
  }, context, testSettingName);
78
78
  };
79
79
 
80
- const externalScriptTest = async(context) => {
80
+ const externalScriptTest = async (context) => {
81
81
  // eslint-disable-next-line no-shadow -- less intuitive
82
- await pageanTest('should not have external scripts', async(context) => {
82
+ await pageanTest('should not have external scripts', async (context) => {
83
83
  // istanbul ignore next: injects script causing puppeteer error, see #48
84
84
  const scripts = await context.page.evaluate(() => {
85
85
  return [...document.querySelectorAll('script[src]')].map(s => s.src);
@@ -96,9 +96,9 @@ const externalScriptTest = async(context) => {
96
96
  }, context, 'externalScriptTest');
97
97
  };
98
98
 
99
- const brokenLinkTest = async(context) => {
99
+ const brokenLinkTest = async (context) => {
100
100
  // eslint-disable-next-line no-shadow -- less intuitive
101
- await pageanTest('should not have broken links', async(context) => {
101
+ await pageanTest('should not have broken links', async (context) => {
102
102
  // istanbul ignore next: injects script causing puppeteer error, see #48
103
103
  const links = await context.page.evaluate(() => {
104
104
  return [...document.querySelectorAll('a[href]')].map(a => a.href);
@@ -112,11 +112,11 @@ const brokenLinkTest = async(context) => {
112
112
 
113
113
  // Check each link includes check against ignored list, and if not checks
114
114
  // both links within the page as well as to other pages
115
- const linkResponses = await Promise.all(uniqueHttpLinks.map(async(link) =>
116
- ({ href: link, status: await linkUtils.checkLink(context, link) })));
115
+ const linkResponses = await Promise.all(uniqueHttpLinks.map(async (link) =>
116
+ ({ href: link, status: await context.linkChecker.checkLink(context, link) })));
117
117
 
118
118
  // Returned results includes status for all links, so filter down to only failed
119
- const failedLinkResponses = linkResponses.filter(result => linkUtils.isFailedResponse(result));
119
+ const failedLinkResponses = linkResponses.filter(result => isFailedResponse(result));
120
120
  const testResult = { result: failedLinkResponses.length > 0 ? testResultStates.failed : testResultStates.passed };
121
121
  if (testResult.result === testResultStates.failed) {
122
122
  testResult.data = failedLinkResponses;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagean",
3
- "version": "4.4.2",
3
+ "version": "6.0.1",
4
4
  "description": "Pagean is a web page analysis tool designed to automate tests requiring web pages to be loaded in a browser window (e.g. horizontal scrollbar, console errors)",
5
5
  "bin": {
6
6
  "pagean": "./bin/pagean.js",
@@ -16,7 +16,7 @@
16
16
  "lint-js": "eslint \"**/*.js\"",
17
17
  "lint-md": "markdownlint **/*.md --ignore node_modules",
18
18
  "lint": "npm run lint-css && npm run lint-html && npm run lint-js && npm run lint-md",
19
- "push": "npm run start-lint-all && npm audit --audit-level=high"
19
+ "push": "npm run start-lint-all && npm audit --audit-level=critical"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -31,46 +31,44 @@
31
31
  "puppeteer",
32
32
  "testing"
33
33
  ],
34
- "author": {
35
- "name": "Aaron Goldenthal"
36
- },
34
+ "author": "Aaron Goldenthal <npm@aarongoldenthal.com>",
37
35
  "license": "MIT",
38
36
  "engines": {
39
- "node": "^10.13.0 || ^12.13.0 || >=14.0.0"
37
+ "node": "^12.20.0 || ^14.15.0 || >=16.0.0"
40
38
  },
39
+ "files": [
40
+ "index.js",
41
+ "bin/",
42
+ "docs/",
43
+ "lib/",
44
+ "schemas/"
45
+ ],
41
46
  "bugs": {
42
47
  "url": "https://gitlab.com/gitlab-ci-utils/pagean/issues"
43
48
  },
44
49
  "homepage": "https://gitlab.com/gitlab-ci-utils/pagean#readme",
45
50
  "devDependencies": {
46
- "@aarongoldenthal/eslint-config-standard": "^6.2.0",
47
- "@aarongoldenthal/stylelint-config-standard": "^2.0.0",
48
- "bin-tester": "^1.3.1",
49
- "eslint": "^7.22.0",
50
- "husky": "^4.3.8",
51
- "jest": "^26.6.3",
52
- "jest-junit": "^12.0.0",
53
- "markdownlint-cli": "^0.27.1",
54
- "strip-ansi": "^6.0.0",
55
- "stylelint": "^13.12.0"
51
+ "@aarongoldenthal/eslint-config-standard": "^10.0.1",
52
+ "@aarongoldenthal/stylelint-config-standard": "^5.0.0",
53
+ "bin-tester": "^2.0.1",
54
+ "eslint": "^8.2.0",
55
+ "jest": "^27.3.1",
56
+ "jest-junit": "^13.0.0",
57
+ "markdownlint-cli": "^0.29.0",
58
+ "strip-ansi": "^6.0.1",
59
+ "stylelint": "^14.0.1"
56
60
  },
57
61
  "dependencies": {
58
- "ajv": "^7.2.3",
59
- "ajv-errors": "^2.0.1",
60
- "axios": "^0.21.1",
61
- "ci-logger": "^3.0.4",
62
- "commander": "^7.2.0",
62
+ "ajv": "^8.7.1",
63
+ "ajv-errors": "^3.0.0",
64
+ "axios": "^0.24.0",
65
+ "ci-logger": "^4.0.1",
66
+ "commander": "^8.3.0",
63
67
  "handlebars": "^4.7.7",
64
- "htmlhint": "^0.14.2",
68
+ "htmlhint": "^0.16.0",
65
69
  "kleur": "^4.1.4",
66
- "normalize-url": "^5.3.0",
70
+ "normalize-url": "^6.1.0",
67
71
  "protocolify": "^3.0.0",
68
- "puppeteer": "^8.0.0"
69
- },
70
- "husky": {
71
- "hooks": {
72
- "pre-commit": "npm run lint",
73
- "pre-push": "npm run push"
74
- }
72
+ "puppeteer": "^11.0.0"
75
73
  }
76
74
  }