pagean 6.0.9 → 7.0.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.
package/README.md CHANGED
@@ -44,13 +44,11 @@ The console output test fails if any output is written to the browser console. A
44
44
  ```json
45
45
  [
46
46
  {
47
- "_args": [],
48
- "_location": {
49
- "lineNumber": undefined,
47
+ "type": "error",
48
+ "text": "Failed to load resource: net::ERR_NAME_NOT_RESOLVED",
49
+ "location": {
50
50
  "url": "https://this.url.does.not.exist/file.js"
51
- },
52
- "_text": "Failed to load resource: net::ERR_NAME_NOT_RESOLVED",
53
- "_type": "error"
51
+ }
54
52
  }
55
53
  ]
56
54
  ```
package/bin/pagean.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- const { log, levels } = require('ci-logger');
4
+ const { log, Levels } = require('ci-logger');
5
5
  const program = require('commander');
6
6
  const pagean = require('../index');
7
7
  const getConfig = require('../lib/config');
@@ -25,7 +25,7 @@ try {
25
25
  } catch (error) {
26
26
  log({
27
27
  message: `Error executing pagean tests\n${error.message}`,
28
- level: levels.error,
28
+ level: Levels.Error,
29
29
  exitOnError: true,
30
30
  errorCode: 1
31
31
  });
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- const { log, levels } = require('ci-logger');
4
+ const { log, Levels } = require('ci-logger');
5
5
  const program = require('commander');
6
6
  const { green, underline } = require('kleur');
7
7
  const { lintConfigFile } = require('../lib/config');
@@ -19,7 +19,7 @@ program
19
19
  const options = program.opts();
20
20
 
21
21
  const logError = (message, exitOnError = true) => {
22
- log({ message, level: levels.error, exitOnError, errorCode: 1 });
22
+ log({ message, level: Levels.Error, exitOnError, errorCode: 1 });
23
23
  };
24
24
 
25
25
  const outputJsonResults = (configFileName, lintResults) => {
package/index.js CHANGED
@@ -29,15 +29,11 @@ const executeAllTests = async (config) => {
29
29
 
30
30
  const consoleLog = [];
31
31
  const page = await browser.newPage();
32
- // Object property names defined by puppeteer API
33
32
  page.on('console', (message) =>
34
33
  consoleLog.push({
35
- // eslint-disable-next-line no-underscore-dangle
36
- _type: message._type,
37
- // eslint-disable-next-line no-underscore-dangle
38
- _text: message._text,
39
- // eslint-disable-next-line no-underscore-dangle
40
- _stackTraceLocations: message._stackTraceLocations
34
+ type: message.type(),
35
+ text: message.text(),
36
+ location: message.location()
41
37
  })
42
38
  );
43
39
  await page.goto(testUrl.url, { waitUntil: 'load' });
package/lib/link-utils.js CHANGED
@@ -31,10 +31,10 @@ const httpResponse = Object.freeze({
31
31
 
32
32
  const noRetryResponses = new Set([httpResponse.tooManyRequests]);
33
33
 
34
- // eslint-disable-next-line jsdoc/require-description-complete-sentence
34
+ /* eslint-disable jsdoc/require-description-complete-sentence */
35
35
  /**
36
- * Normalizes a URL with https://www.npmjs.com/package/normalize-url
37
- * using defaults plus the following overrides:
36
+ * Normalizes a URL (with https://www.npmjs.com/package/normalize-url).
37
+ * Uses defaults plus the following overrides.
38
38
  * 1. Set default protocol to https if protocol-relative
39
39
  * 2. Do not remove any querystring parameters
40
40
  * 3. Strip hash from URL
@@ -42,8 +42,8 @@ const noRetryResponses = new Set([httpResponse.tooManyRequests]);
42
42
  *
43
43
  * @public
44
44
  * @static
45
- * @param {string} url The URL to normalize.
46
- * @returns {string} The normalized URL.
45
+ * @param {string} url The URL to normalize.
46
+ * @returns {string} The normalized URL.
47
47
  */
48
48
  const normalizeLink = (url) =>
49
49
  normalizeUrl(url, {
@@ -52,6 +52,7 @@ const normalizeLink = (url) =>
52
52
  stripHash: true,
53
53
  stripWWW: false
54
54
  });
55
+ /* eslint-enable jsdoc/require-description-complete-sentence */
55
56
 
56
57
  /**
57
58
  * Checks settings to determine if the provided link should be ignored.
package/lib/tests.js CHANGED
@@ -80,9 +80,7 @@ const consoleErrorTest = (context) => {
80
80
  // eslint-disable-next-line no-shadow -- less intuitive
81
81
  (context) => {
82
82
  const browserErrorLog = context.consoleLog.filter(
83
- // Object property names defined by puppeteer API
84
- // eslint-disable-next-line no-underscore-dangle
85
- (log) => log._type === 'error'
83
+ (log) => log.type === 'error'
86
84
  );
87
85
  const testResult = {
88
86
  result:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagean",
3
- "version": "6.0.9",
3
+ "version": "7.0.0",
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",
@@ -37,7 +37,7 @@
37
37
  "author": "Aaron Goldenthal <npm@aarongoldenthal.com>",
38
38
  "license": "MIT",
39
39
  "engines": {
40
- "node": "^12.20.0 || ^14.15.0 || >=16.0.0"
40
+ "node": "^14.15.0 || ^16.13.0 || >=18.0.0"
41
41
  },
42
42
  "files": [
43
43
  "index.js",
@@ -51,28 +51,28 @@
51
51
  },
52
52
  "homepage": "https://gitlab.com/gitlab-ci-utils/pagean",
53
53
  "devDependencies": {
54
- "@aarongoldenthal/eslint-config-standard": "^14.0.0",
55
- "@aarongoldenthal/stylelint-config-standard": "^8.0.0",
54
+ "@aarongoldenthal/eslint-config-standard": "^15.0.0",
55
+ "@aarongoldenthal/stylelint-config-standard": "^9.0.0",
56
56
  "bin-tester": "^2.0.1",
57
- "eslint": "^8.14.0",
58
- "jest": "^28.0.2",
57
+ "eslint": "^8.17.0",
58
+ "jest": "^28.1.1",
59
59
  "jest-junit": "^13.2.0",
60
60
  "markdownlint-cli": "^0.31.1",
61
- "prettier": "^2.6.2",
61
+ "prettier": "^2.7.0",
62
62
  "strip-ansi": "^6.0.1",
63
- "stylelint": "^14.8.0"
63
+ "stylelint": "^14.9.1"
64
64
  },
65
65
  "dependencies": {
66
66
  "ajv": "^8.11.0",
67
67
  "ajv-errors": "^3.0.0",
68
68
  "axios": "^0.27.2",
69
- "ci-logger": "^4.0.2",
70
- "commander": "^9.2.0",
69
+ "ci-logger": "^5.0.0",
70
+ "commander": "^9.3.0",
71
71
  "handlebars": "^4.7.7",
72
72
  "htmlhint": "^1.1.4",
73
73
  "kleur": "^4.1.4",
74
74
  "normalize-url": "^6.1.0",
75
75
  "protocolify": "^3.0.0",
76
- "puppeteer": "^13.6.0"
76
+ "puppeteer": "^14.4.0"
77
77
  }
78
78
  }