@axe-core/watcher 2.3.3 → 2.4.0-next.6f098287

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.
@@ -8,8 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  const util_1 = require("./util");
16
+ const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
13
17
  class Controller {
14
18
  constructor() {
15
19
  this.isStopped = false;
@@ -71,17 +75,24 @@ class Controller {
71
75
  }
72
76
  flush() {
73
77
  return __awaiter(this, void 0, void 0, function* () {
74
- yield this.executeScript(() => {
78
+ const results = yield this.executeScript(() => {
75
79
  return new Promise(resolve => {
76
- const fn = () => {
77
- window.removeEventListener('axe:flush-end', fn);
78
- resolve();
80
+ const receivedResults = [];
81
+ const onFlushEnd = () => {
82
+ window.removeEventListener('axe:flush-end', onFlushEnd);
83
+ window.removeEventListener('axe:result', onAxeResult);
84
+ resolve(receivedResults);
85
+ };
86
+ const onAxeResult = (e) => {
87
+ receivedResults.push(...e.detail);
79
88
  };
80
- window.addEventListener('axe:flush-end', fn);
89
+ window.addEventListener('axe:result', onAxeResult);
90
+ window.addEventListener('axe:flush-end', onFlushEnd);
81
91
  const event = new CustomEvent('axe:flush-start');
82
92
  window.dispatchEvent(event);
83
93
  });
84
94
  });
95
+ yield (0, sendResultsToServer_1.default)(results);
85
96
  });
86
97
  }
87
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA0C;AAE1C,MAAe,UAAU;IAAzB;QAMY,cAAS,GAAG,KAAK,CAAA;IAwE7B,CAA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oBAED,MAAM,WAAW,GAAG,CAAC,CAAwB,EAAQ,EAAE;wBACrD,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;oBACnC,CAAC,CAAA;oBAED,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,WAAyB,CAAC,CAAA;oBAChE,MAAM,CAAC,gBAAgB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;oBACpD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAA;oBAChD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;gBAC7B,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YACF,MAAM,IAAA,6BAAmB,EAAC,OAAO,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAED,kBAAe,UAAU,CAAA"}
package/dist/cypress.js CHANGED
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __rest = (this && this.__rest) || function (s, e) {
3
12
  var t = {};
4
13
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10,9 +19,14 @@ var __rest = (this && this.__rest) || function (s, e) {
10
19
  }
11
20
  return t;
12
21
  };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
13
25
  Object.defineProperty(exports, "__esModule", { value: true });
14
26
  exports.cypressConfig = void 0;
27
+ const fs_1 = __importDefault(require("fs"));
15
28
  const util_1 = require("./util");
29
+ const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
16
30
  /**
17
31
  * Create a Cypress config that uses the axe Watcher extension.
18
32
  *
@@ -46,6 +60,18 @@ const cypressConfig = (config) => {
46
60
  }
47
61
  return launchOptions;
48
62
  });
63
+ // Read the results sent from the extension, then forward to the server.
64
+ on('after:run', () => __awaiter(this, void 0, void 0, function* () {
65
+ const results = fs_1.default
66
+ .readdirSync('cypress/axe-watcher')
67
+ .filter(f => f.endsWith('.json'));
68
+ for (const result of results) {
69
+ const data = fs_1.default.readFileSync(`cypress/axe-watcher/${result}`, 'utf8');
70
+ const parsed = JSON.parse(data);
71
+ yield (0, sendResultsToServer_1.default)(parsed);
72
+ fs_1.default.unlinkSync(`cypress/axe-watcher/${result}`);
73
+ }
74
+ }));
49
75
  } }) });
50
76
  };
51
77
  exports.cypressConfig = cypressConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,iCAMe;AAEf;;;;GAIG;AAEI,MAAM,aAAa,GAAG,CAC3B,MAA6C,EACtB,EAAE;IACzB,MAAM,EAAE,GAAG,KAAoB,MAAM,EAArB,UAAU,UAAK,MAAM,EAA/B,OAAsB,CAAS,CAAA;IAErC,IAAA,qBAAc,kCACT,GAAG;QACN,sDAAsD;QACtD,OAAO,EAAE,IAAI,IACb,CAAA;IACF,IAAA,oBAAa,EAAC;QACZ,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE;YACb,0BAA0B;YAC1B,4BAA4B;YAC5B,4BAA4B;YAC5B,uBAAuB;SACxB;KACF,CAAC,CAAA;IAEF,uCACK,UAAU,KACb,GAAG,kCACE,UAAU,CAAC,GAAG,KACjB,eAAe,CAAC,EAAE,EAAE,GAAG,IAAI;;gBACzB,MAAA,MAAA,UAAU,CAAC,GAAG,0CAAE,eAAe,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EAAE,aAAa,EAAE,EAAE;oBACrD,0BAA0B;oBAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;wBAC7B,IAAI,OAAO,CAAC,UAAU,EAAE;4BACtB,MAAM,IAAI,gCAAyB,EAAE,CAAA;yBACtC;wBAED,sBAAsB;wBACtB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,oBAAa,CAAC,CAAA;qBAC1C;oBAED,OAAO,aAAa,CAAA;gBACtB,CAAC,CAAC,CAAA;gBAEF,wEAAwE;gBACxE,EAAE,CAAC,WAAW,EAAE,GAAS,EAAE;oBACzB,MAAM,OAAO,GAAG,YAAE;yBACf,WAAW,CAAC,qBAAqB,CAAC;yBAClC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;oBACnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;wBAC5B,MAAM,IAAI,GAAG,YAAE,CAAC,YAAY,CAC1B,uBAAuB,MAAM,EAAE,EAC/B,MAAM,CACP,CAAA;wBACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;wBAC/B,MAAM,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAA;wBACjC,YAAE,CAAC,UAAU,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAA;qBAC/C;gBACH,CAAC,CAAA,CAAC,CAAA;YACJ,CAAC,OAEJ;AACH,CAAC,CAAA;AA3DY,QAAA,aAAa,iBA2DzB"}
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-unused-vars, prefer-const */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.WRAPPED_COMMANDS = void 0;
5
4
  /**
@@ -115,14 +114,26 @@ Cypress.Commands.add('axeFlush', () => {
115
114
  return Promise.resolve();
116
115
  }
117
116
  return new Promise(resolve => {
118
- const fn = () => {
119
- win.removeEventListener('axe:flush-end', fn);
117
+ const results = [];
118
+ const onAxeResult = (event) => {
119
+ results.push(...event.detail);
120
+ };
121
+ const onFlushEnd = () => {
122
+ win.removeEventListener('axe:flush-end', onFlushEnd);
123
+ win.removeEventListener('axe:result', onAxeResult);
120
124
  win.__AXE_WATCHER_HAS_VISITED = false;
121
- resolve();
125
+ resolve(results);
122
126
  };
123
- win.addEventListener('axe:flush-end', fn);
127
+ win.addEventListener('axe:flush-end', onFlushEnd);
128
+ win.addEventListener('axe:result', onAxeResult);
124
129
  const event = new CustomEvent('axe:flush-start');
125
130
  win.dispatchEvent(event);
131
+ }).then(results => {
132
+ // Generate a random-enough filename to avoid collisions.
133
+ const time = new Date().getTime();
134
+ const rnd = Math.random().toString(36).slice(2);
135
+ const filename = `cypress/axe-watcher/${time}-${rnd}.json`;
136
+ cy.writeFile(filename, JSON.stringify(results, null, 2));
126
137
  });
127
138
  });
128
139
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;AA2BpE;;;;;;;GAOG;AAEH,IAAI,SAAS,GAAG,KAAK,CAAA;AAIrB,4DAA4D;AAC/C,QAAA,gBAAgB,GAAiC;IAC5D,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,gBAAgB;IAChB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,SAAS;IACT,MAAM;CACP,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE;;IACzD,MAAM,cAAc,GAAG,MAAA,MAAA,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,0CAAE,UAAU,0CAAE,IAA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AC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,SAAS,GAAG,KAAK,CAAA;QACnB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,GAAS,EAAE;IACzC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YACjC,MAAM,EAAE,GAAG,GAAS,EAAE;gBACpB,GAAG,CAAC,mBAAmB,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA;gBACtD,OAAO,EAAE,CAAA;YACX,CAAC,CAAA;YACD,GAAG,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA;YACnD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,oBAAoB,CAAC,CAAA;YACnD,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,SAAS,GAAG,IAAI,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*! Copyright Deque 2021-2023 All Rights Reserved */
2
- export { puppeteerConfig, PuppeteerController, wrapPuppeteer } from './puppeteer';
2
+ export { puppeteerConfig, PuppeteerController, wrapPuppeteer, wrapPuppeteerPage } from './puppeteer';
3
3
  export { wdioConfig, wdioTestRunner, WdioController, wrapWdio } from './wdio';
4
4
  export { webdriverConfig, WebdriverController, wrapWebdriver } from './webdriver';
5
- export { playwrightConfig, PlaywrightController, wrapPlaywright } from './playwright';
5
+ export { playwrightConfig, PlaywrightController, wrapPlaywright, wrapPlaywrightPage } from './playwright';
6
6
  export { default as playwrightTest } from './playwrightTest';
7
7
  export { cypressConfig } from './cypress';
package/dist/index.js CHANGED
@@ -4,11 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.cypressConfig = exports.playwrightTest = exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = exports.wrapWebdriver = exports.WebdriverController = exports.webdriverConfig = exports.wrapWdio = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = exports.wrapPuppeteer = exports.PuppeteerController = exports.puppeteerConfig = void 0;
7
+ exports.cypressConfig = exports.playwrightTest = exports.wrapPlaywrightPage = exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = exports.wrapWebdriver = exports.WebdriverController = exports.webdriverConfig = exports.wrapWdio = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = exports.wrapPuppeteerPage = exports.wrapPuppeteer = exports.PuppeteerController = exports.puppeteerConfig = void 0;
8
8
  var puppeteer_1 = require("./puppeteer");
9
9
  Object.defineProperty(exports, "puppeteerConfig", { enumerable: true, get: function () { return puppeteer_1.puppeteerConfig; } });
10
10
  Object.defineProperty(exports, "PuppeteerController", { enumerable: true, get: function () { return puppeteer_1.PuppeteerController; } });
11
11
  Object.defineProperty(exports, "wrapPuppeteer", { enumerable: true, get: function () { return puppeteer_1.wrapPuppeteer; } });
12
+ Object.defineProperty(exports, "wrapPuppeteerPage", { enumerable: true, get: function () { return puppeteer_1.wrapPuppeteerPage; } });
12
13
  var wdio_1 = require("./wdio");
13
14
  Object.defineProperty(exports, "wdioConfig", { enumerable: true, get: function () { return wdio_1.wdioConfig; } });
14
15
  Object.defineProperty(exports, "wdioTestRunner", { enumerable: true, get: function () { return wdio_1.wdioTestRunner; } });
@@ -22,6 +23,7 @@ var playwright_1 = require("./playwright");
22
23
  Object.defineProperty(exports, "playwrightConfig", { enumerable: true, get: function () { return playwright_1.playwrightConfig; } });
23
24
  Object.defineProperty(exports, "PlaywrightController", { enumerable: true, get: function () { return playwright_1.PlaywrightController; } });
24
25
  Object.defineProperty(exports, "wrapPlaywright", { enumerable: true, get: function () { return playwright_1.wrapPlaywright; } });
26
+ Object.defineProperty(exports, "wrapPlaywrightPage", { enumerable: true, get: function () { return playwright_1.wrapPlaywrightPage; } });
25
27
  var playwrightTest_1 = require("./playwrightTest");
26
28
  Object.defineProperty(exports, "playwrightTest", { enumerable: true, get: function () { return __importDefault(playwrightTest_1).default; } });
27
29
  var cypress_1 = require("./cypress");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,yCAIoB;AAHlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAEf,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAIoB;AAHlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAEf,2CAIqB;AAHnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AAEhB,mDAA4D;AAAnD,iIAAA,OAAO,OAAkB;AAClC,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,yCAKoB;AAJlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,8GAAA,iBAAiB,OAAA;AAEnB,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAIoB;AAHlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAEf,2CAKqB;AAJnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AACd,gHAAA,kBAAkB,OAAA;AAEpB,mDAA4D;AAAnD,iIAAA,OAAO,OAAkB;AAClC,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
@@ -1,7 +1,6 @@
1
- import type { LaunchOptions, Page } from 'playwright-core';
1
+ import type { LaunchOptions, Page, BrowserContext } from 'playwright-core';
2
2
  import { type Configuration } from './util';
3
3
  import Controller from './Controller';
4
- import { wrapBrowserContext } from './playwrightWrapping';
5
4
  /** Options for configuring Playwright and @axe-core/watcher. */
6
5
  export declare type Options = Configuration & LaunchOptions;
7
6
  /**
@@ -15,4 +14,8 @@ export declare class PlaywrightController extends Controller {
15
14
  constructor(driver: Page);
16
15
  protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;
17
16
  }
18
- export { wrapBrowserContext as wrapPlaywright };
17
+ /**
18
+ * @deprecated `wrapPlaywright` is deprecated and may not work as intended. Please use `wrapPlaywrightPage` instead.
19
+ */
20
+ export declare const wrapPlaywright: (browserContext: BrowserContext, playwrightController: PlaywrightController) => BrowserContext;
21
+ export { wrapPage as wrapPlaywrightPage } from './playwrightWrapping';
@@ -23,11 +23,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = void 0;
26
+ exports.wrapPlaywrightPage = exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = void 0;
27
27
  const util_1 = require("./util");
28
28
  const Controller_1 = __importDefault(require("./Controller"));
29
- const playwrightWrapping_1 = require("./playwrightWrapping");
30
- Object.defineProperty(exports, "wrapPlaywright", { enumerable: true, get: function () { return playwrightWrapping_1.wrapBrowserContext; } });
31
29
  /**
32
30
  * Creates a Playwright config that uses axe extension
33
31
  *
@@ -58,4 +56,23 @@ class PlaywrightController extends Controller_1.default {
58
56
  }
59
57
  }
60
58
  exports.PlaywrightController = PlaywrightController;
59
+ /**
60
+ * @deprecated `wrapPlaywright` is deprecated and may not work as intended. Please use `wrapPlaywrightPage` instead.
61
+ */
62
+ const wrapPlaywright = (
63
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
+ browserContext,
65
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
66
+ playwrightController) => {
67
+ throw new Error(`
68
+ \`wrapPlaywright\` is deprecated and may not work as intended. Please use \`wrapPlaywrightPage\` instead. Example:\n
69
+ let page = await browserContext.newPage()
70
+ const controller = new PlaywrightController(page)
71
+ // Use the new wrapped \`page\` object
72
+ page = wrapPlaywrightPage(page, controller)
73
+ `);
74
+ };
75
+ exports.wrapPlaywright = wrapPlaywright;
76
+ var playwrightWrapping_1 = require("./playwrightWrapping");
77
+ Object.defineProperty(exports, "wrapPlaywrightPage", { enumerable: true, get: function () { return playwrightWrapping_1.wrapPage; } });
61
78
  //# sourceMappingURL=playwright.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAKe;AACf,8DAAqC;AACrC,6DAAyD;AAgD1B,+FAhDtB,uCAAkB,OAgDkB;AA3C7C;;;;GAIG;AAEH,SAAgB,gBAAgB,CAAC,IAAa;IAC5C,MAAM,EAAE,GAAG,KAAgB,IAAI,EAAf,MAAM,UAAK,IAAI,EAAzB,OAAkB,CAAO,CAAA;IAC/B,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAE1B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAI,M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,oBAAU;IAGlD,YAAY,MAAY;QACtB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEe,aAAa,CAC3B,EAA+B,EAC/B,GAAG,IAAe;;YAElB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE,CAAA;YACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAI,EAAE,EAAE,GAAG,CAAC,CAAA;YACrD,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;CACF;AAhBD,oDAgBC;AAED;;GAEG;AACI,MAAM,cAAc,GAAG;AAC5B,6DAA6D;AAC7D,cAA8B;AAC9B,6DAA6D;AAC7D,oBAA0C,EAC1B,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC;;;;;;GAMf,CAAC,CAAA;AACJ,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B;AAED,2DAAqE;AAA5D,wHAAA,QAAQ,OAAsB"}
@@ -58,9 +58,9 @@ const playwrightTest = (options) => {
58
58
  yield use(context);
59
59
  yield context.close();
60
60
  }),
61
- page: ({ page, context }, use) => __awaiter(void 0, void 0, void 0, function* () {
61
+ page: ({ page }, use) => __awaiter(void 0, void 0, void 0, function* () {
62
62
  controller = new playwright_1.PlaywrightController(page);
63
- (0, playwright_1.wrapPlaywright)(context, controller);
63
+ page = (0, playwright_1.wrapPlaywrightPage)(page, controller);
64
64
  yield use(page);
65
65
  })
66
66
  });
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/playwrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUA,6CAIqB;AACrB,iCAAsD;AAYtD;;;;;;GAMG;AAEH,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAe,EAAE;IACvD,IAAI,UAAU,GAAgC,IAAI,CAAA;IAClD,MAAM,EAAE,GAAG,KAAgB,OAAO,EAAlB,MAAM,UAAK,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E,GAAG,oBAAa,CAAC,IAChD,CAAA;YACF,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;YAClB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC,CAAA;QACD,IAAI,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;YAC5B,UAAU,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,CAAA;YAC3C,IAAI,GAAG,IAAA,+BAAkB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAA;YAC3C,MAAM,GAAG,CAAC,IAAI,CAAC,CAAA;QACjB,CAAC,CAAA;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,SAAS,CAAC,GAAS,EAAE;QACxB,MAAM,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,CAAA,CAAA;IAC3B,CAAC,CAAA,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AACzB,CAAC,CAAA;AAED,kBAAe,cAAc,CAAA"}
@@ -1,7 +1,6 @@
1
- import type { LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions, Page } from 'puppeteer';
1
+ import type { LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions, Page, BrowserContext } from 'puppeteer';
2
2
  import { type Configuration } from './util';
3
3
  import Controller from './Controller';
4
- export { wrapBrowserContext as wrapPuppeteer } from './puppeteerWrapping';
5
4
  declare type Options = LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions;
6
5
  /**
7
6
  * Creates a Puppeteer config that uses axe extension.
@@ -14,3 +13,8 @@ export declare class PuppeteerController extends Controller {
14
13
  constructor(driver: Page);
15
14
  protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;
16
15
  }
16
+ /**
17
+ * @deprecated `wrapPuppeteer` is deprecated and may not work as intended. Please use `wrapPuppeteerPage` instead.
18
+ */
19
+ export declare const wrapPuppeteer: (browserContext: BrowserContext, controller: PuppeteerController) => BrowserContext;
20
+ export { wrapPage as wrapPuppeteerPage } from './puppeteerWrapping';
package/dist/puppeteer.js CHANGED
@@ -23,11 +23,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.PuppeteerController = exports.puppeteerConfig = exports.wrapPuppeteer = void 0;
26
+ exports.wrapPuppeteerPage = exports.wrapPuppeteer = exports.PuppeteerController = exports.puppeteerConfig = void 0;
27
27
  const util_1 = require("./util");
28
28
  const Controller_1 = __importDefault(require("./Controller"));
29
- var puppeteerWrapping_1 = require("./puppeteerWrapping");
30
- Object.defineProperty(exports, "wrapPuppeteer", { enumerable: true, get: function () { return puppeteerWrapping_1.wrapBrowserContext; } });
31
29
  /**
32
30
  * Creates a Puppeteer config that uses axe extension.
33
31
  *
@@ -57,4 +55,23 @@ class PuppeteerController extends Controller_1.default {
57
55
  }
58
56
  }
59
57
  exports.PuppeteerController = PuppeteerController;
58
+ /**
59
+ * @deprecated `wrapPuppeteer` is deprecated and may not work as intended. Please use `wrapPuppeteerPage` instead.
60
+ */
61
+ const wrapPuppeteer = (
62
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
+ browserContext,
64
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
65
+ controller) => {
66
+ throw new Error(`
67
+ \`wrapPuppeteer\` is deprecated and may not work as intended. Please use \`wrapPuppeteerPage\` instead. Example:\n
68
+ let page = await browser.newPage()
69
+ const controller = new PuppeteerController(page)
70
+ // Use the new wrapped \`page\` object
71
+ page = wrapPuppeteerPage(page, controller)
72
+ `);
73
+ };
74
+ exports.wrapPuppeteer = wrapPuppeteer;
75
+ var puppeteerWrapping_1 = require("./puppeteerWrapping");
76
+ Object.defineProperty(exports, "wrapPuppeteerPage", { enumerable: true, get: function () { return puppeteerWrapping_1.wrapPage; } });
60
77
  //# sourceMappingURL=puppeteer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../src/puppeteer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,iCAKe;AACf,8DAAqC;AAErC,yDAAyE;AAAhE,kHAAA,kBAAkB,OAAiB;AAM5C;;;;GAIG;AAEH,SAAgB,eAAe,CAAC,IAA6B;IAC3D,MAAM,EAAE,GAAG,KAAgB,IAAI,EAAf,MAAM,UAAK,IAAI,EAAzB,OAAkB,CAAO,CAAA;IAC/B,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAE1B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAa,CAAC,CAAA;IAEjC,uCACK,MAAM,KACT,QAAQ,EAAE,KAAK,EACf,IAAI,IACL;AACH,CAAC;AAjBD,0CAiBC;AAED,MAAa,mBAAoB,SAAQ,oBAAU;IAGjD,YAAY,MAAY;QACtB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEe,aAAa,CAC3B,EAA+B,EAC/B,GAAG,IAAe;;YAElB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;YACtD,OAAO,MAAW,CAAA;QACpB,CAAC;KAAA;CACF;AAfD,kDAeC"}
1
+ {"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../src/puppeteer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,iCAKe;AACf,8DAAqC;AAMrC;;;;GAIG;AAEH,SAAgB,eAAe,CAAC,IAA6B;IAC3D,MAAM,EAAE,GAAG,KAAgB,IAAI,EAAf,MAAM,UAAK,IAAI,EAAzB,OAAkB,CAAO,CAAA;IAC/B,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAE1B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAa,CAAC,CAAA;IAEjC,uCACK,MAAM,KACT,QAAQ,EAAE,KAAK,EACf,IAAI,IACL;AACH,CAAC;AAjBD,0CAiBC;AAED,MAAa,mBAAoB,SAAQ,oBAAU;IAGjD,YAAY,MAAY;QACtB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEe,aAAa,CAC3B,EAA+B,EAC/B,GAAG,IAAe;;YAElB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;YACtD,OAAO,MAAW,CAAA;QACpB,CAAC;KAAA;CACF;AAfD,kDAeC;AAED;;GAEG;AACI,MAAM,aAAa,GAAG;AAC3B,6DAA6D;AAC7D,cAA8B;AAC9B,6DAA6D;AAC7D,UAA+B,EACf,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC;;;;;;KAMb,CAAC,CAAA;AACN,CAAC,CAAA;AAbY,QAAA,aAAa,iBAazB;AAED,yDAAmE;AAA1D,sHAAA,QAAQ,OAAqB"}
@@ -0,0 +1,16 @@
1
+ import type { AxeResults } from 'axe-core';
2
+ /**
3
+ * Number of page states to send to the server at once.
4
+ *
5
+ * Increasing this too much will cause the server to 413 (Request
6
+ * Entity Too Large), as the request body will be enormous.
7
+ */
8
+ export declare const MAX_PAGE_STATES_PER_REQUEST = 5;
9
+ export interface Result {
10
+ page_state: string;
11
+ results: AxeResults;
12
+ screenshot: string | null;
13
+ screenshot_id: string | null;
14
+ }
15
+ export declare const sendResultsToServer: (results: Result[]) => Promise<void>;
16
+ export default sendResultsToServer;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.sendResultsToServer = exports.MAX_PAGE_STATES_PER_REQUEST = void 0;
39
+ const node_fetch_1 = __importDefault(require("node-fetch"));
40
+ const uuid_1 = require("uuid");
41
+ const util_1 = require("./util");
42
+ const git = __importStar(require("./git"));
43
+ // Read the version from package.json, but do not include the file in the build.
44
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
45
+ const { version } = require('../package.json');
46
+ /**
47
+ * Number of page states to send to the server at once.
48
+ *
49
+ * Increasing this too much will cause the server to 413 (Request
50
+ * Entity Too Large), as the request body will be enormous.
51
+ */
52
+ exports.MAX_PAGE_STATES_PER_REQUEST = 5;
53
+ const gitData = {};
54
+ if (git.isRepository()) {
55
+ gitData.git_branch = git.getBranchName();
56
+ gitData.git_tag = git.getTag();
57
+ gitData.git_default_branch = git.getDefaultBranchName();
58
+ gitData.git_url = git.getRemoteURL();
59
+ gitData.git_is_dirty = git.isDirty();
60
+ const info = git.getCommitInfo();
61
+ gitData.git_commit_sha = info === null || info === void 0 ? void 0 : info.hash;
62
+ gitData.git_commit_author = info === null || info === void 0 ? void 0 : info.author;
63
+ gitData.git_commit_email = info === null || info === void 0 ? void 0 : info.email;
64
+ gitData.git_commit_message = info === null || info === void 0 ? void 0 : info.message;
65
+ }
66
+ const sendResultsToServer = (results) => __awaiter(void 0, void 0, void 0, function* () {
67
+ const { server_url, api_key, session_id } = (0, util_1.readVariables)();
68
+ const resultsURL = new URL(`/api-pub/watcher/sessions/${session_id}`, server_url);
69
+ const screenshotsURL = new URL(`/api-pub/watcher/sessions/${session_id}/screenshots`, server_url);
70
+ // Add an correlation ID to each result/screenshot combination (see #622).
71
+ results.forEach(result => {
72
+ if (result.screenshot) {
73
+ result.screenshot_id = (0, uuid_1.v4)();
74
+ }
75
+ });
76
+ // Send the results in batches.
77
+ for (let i = 0; i < results.length; i += exports.MAX_PAGE_STATES_PER_REQUEST) {
78
+ // Remove screenshots from results. They will be sent separately.
79
+ const batch = results
80
+ .slice(i, i + exports.MAX_PAGE_STATES_PER_REQUEST)
81
+ .map(r => (Object.assign(Object.assign({}, r), { screenshot: null })));
82
+ const body = Object.assign({ axe_watcher_version: version, results: batch }, gitData);
83
+ const { ok } = yield (0, node_fetch_1.default)(resultsURL, {
84
+ method: 'PUT',
85
+ redirect: 'follow',
86
+ headers: {
87
+ 'Content-Type': 'application/json',
88
+ 'X-API-Key': api_key
89
+ },
90
+ body: JSON.stringify(body)
91
+ });
92
+ if (!ok) {
93
+ // eslint-disable-next-line no-console
94
+ console.warn('@axe-core/watcher: Unable to send results to server');
95
+ }
96
+ }
97
+ // Send screenshots.
98
+ yield Promise.all(results.map(({ screenshot, screenshot_id }) => __awaiter(void 0, void 0, void 0, function* () {
99
+ if (!screenshot) {
100
+ return;
101
+ }
102
+ // Clone the screenshots URL, then add the screenshot ID.
103
+ const url = new URL(screenshotsURL.href);
104
+ url.searchParams.set('screenshot_id', screenshot_id);
105
+ const { ok } = yield (0, node_fetch_1.default)(url, {
106
+ method: 'PUT',
107
+ redirect: 'follow',
108
+ headers: {
109
+ 'Content-Type': 'image/png',
110
+ 'X-API-Key': api_key
111
+ },
112
+ body: screenshot
113
+ });
114
+ if (!ok) {
115
+ // eslint-disable-next-line no-console
116
+ console.warn('@axe-core/watcher: Unable to send screenshot to server');
117
+ }
118
+ })));
119
+ });
120
+ exports.sendResultsToServer = sendResultsToServer;
121
+ exports.default = exports.sendResultsToServer;
122
+ //# sourceMappingURL=sendResultsToServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendResultsToServer.js","sourceRoot":"","sources":["../src/sendResultsToServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8B;AAE9B,+BAAiC;AACjC,iCAAsC;AACtC,2CAA4B;AAE5B,gFAAgF;AAChF,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE9C;;;;;GAKG;AAEU,QAAA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AA,oBAAK,EAAC,GAAG,EAAE;YAC9B,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE;gBACP,cAAc,EAAE,WAAW;gBAC3B,WAAW,EAAE,OAAO;aACrB;YACD,IAAI,EAAE,UAAU;SACjB,CAAC,CAAA;QAEF,IAAI,CAAC,EAAE,EAAE;YACP,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;SACvE;IACH,CAAC,CAAA,CAAC,CACH,CAAA;AACH,CAAC,CAAA,CAAA;AAzEY,QAAA,mBAAmB,uBAyE/B;AAED,kBAAe,2BAAmB,CAAA"}
package/dist/util.d.ts CHANGED
@@ -37,15 +37,6 @@ export interface Variables {
37
37
  session_id?: string;
38
38
  cypress: boolean;
39
39
  take_screenshots?: boolean;
40
- git_branch?: string | null;
41
- git_tag?: string | null;
42
- git_default_branch?: string | null;
43
- git_commit_message?: string | null;
44
- git_commit_sha?: string | null;
45
- git_commit_author?: string | null;
46
- git_commit_email?: string | null;
47
- git_url?: string | null;
48
- git_is_dirty?: boolean;
49
40
  }
50
41
  /** Write the user's settings to the disk, so the extension can load them. */
51
42
  export declare function writeVariables({ apiKey, serverURL, sessionId, autoAnalyze, cypress, takeScreenshots }: WriteVariablesParams): void;
@@ -61,6 +52,7 @@ interface WriteManifestParams {
61
52
  }
62
53
  /** Update the extension manifest file. */
63
54
  export declare function writeManifest({ all_frames, exclude_globs }: WriteManifestParams): void;
55
+ export declare const readVariables: () => Variables;
64
56
  export declare const updateAutoAnalyze: (val: boolean) => void;
65
57
  declare const kWrapped: unique symbol;
66
58
  export declare type PossiblyWrapped<T> = T & {
package/dist/util.js CHANGED
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,14 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
13
  };
37
14
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.wrappedCallWithSideEffects = exports.markAsWrapped = exports.isWrapped = exports.updateAutoAnalyze = exports.writeManifest = exports.validateApiKey = exports.writeVariables = exports.HeadlessNotSupportedError = exports.extensionArgs = exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.DEFAULT_SERVER_URL = exports.PATH_TO_EXTENSION = void 0;
15
+ exports.wrappedCallWithSideEffects = exports.markAsWrapped = exports.isWrapped = exports.updateAutoAnalyze = exports.readVariables = exports.writeManifest = exports.validateApiKey = exports.writeVariables = exports.HeadlessNotSupportedError = exports.extensionArgs = exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.DEFAULT_SERVER_URL = exports.PATH_TO_EXTENSION = void 0;
39
16
  const uuid_1 = require("uuid");
40
17
  const sync_request_1 = __importDefault(require("sync-request"));
41
18
  const assert_1 = __importDefault(require("assert"));
42
19
  const fs_1 = __importDefault(require("fs"));
43
20
  const path_1 = __importDefault(require("path"));
44
21
  const os_1 = __importDefault(require("os"));
45
- const git = __importStar(require("./git"));
46
22
  exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', 'extension');
47
23
  exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
48
24
  exports.PATH_TO_SESSION_FILE = path_1.default.join(os_1.default.tmpdir(), 'axe-watcher-session.json');
@@ -94,19 +70,6 @@ function writeVariables({ apiKey, serverURL, sessionId, autoAnalyze, cypress, ta
94
70
  auto_analyze: !!autoAnalyze,
95
71
  cypress: !!cypress
96
72
  };
97
- // If the repository is a git repository, add git info to the variables.
98
- if (git.isRepository()) {
99
- variables.git_branch = git.getBranchName();
100
- variables.git_tag = git.getTag();
101
- variables.git_default_branch = git.getDefaultBranchName();
102
- const info = git.getCommitInfo();
103
- variables.git_commit_sha = info === null || info === void 0 ? void 0 : info.hash;
104
- variables.git_commit_author = info === null || info === void 0 ? void 0 : info.author;
105
- variables.git_commit_email = info === null || info === void 0 ? void 0 : info.email;
106
- variables.git_commit_message = info === null || info === void 0 ? void 0 : info.message;
107
- variables.git_url = git.getRemoteURL();
108
- variables.git_is_dirty = git.isDirty();
109
- }
110
73
  fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
111
74
  }
112
75
  exports.writeVariables = writeVariables;
@@ -136,11 +99,15 @@ function writeManifest({ all_frames, exclude_globs }) {
136
99
  fs_1.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
137
100
  }
138
101
  exports.writeManifest = writeManifest;
139
- const updateAutoAnalyze = (val) => {
102
+ const readVariables = () => {
140
103
  const fileContents = fs_1.default.readFileSync(exports.PATH_TO_EXTENSION_VARIABLES, 'utf-8');
141
- const jsonValue = JSON.parse(fileContents);
142
- jsonValue.auto_analyze = val;
143
- fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(jsonValue));
104
+ return JSON.parse(fileContents);
105
+ };
106
+ exports.readVariables = readVariables;
107
+ const updateAutoAnalyze = (val) => {
108
+ const variables = (0, exports.readVariables)();
109
+ variables.auto_analyze = val;
110
+ fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
144
111
  };
145
112
  exports.updateAutoAnalyze = updateAutoAnalyze;
146
113
  const kWrapped = Symbol('axe watcher wrapped');