@axe-core/watcher 2.0.0 → 2.1.1-next.293a245f

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 (48) hide show
  1. package/dist/Controller.d.ts +9 -6
  2. package/dist/Controller.js +102 -139
  3. package/dist/Controller.js.map +1 -1
  4. package/dist/cypress.d.ts +1 -1
  5. package/dist/cypress.js +8 -37
  6. package/dist/cypress.js.map +1 -1
  7. package/dist/cypressCommands.d.ts +8 -5
  8. package/dist/cypressCommands.js +126 -116
  9. package/dist/cypressCommands.js.map +1 -1
  10. package/dist/git.d.ts +2 -0
  11. package/dist/git.js +31 -22
  12. package/dist/git.js.map +1 -1
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +8 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/playwright.d.ts +6 -4
  17. package/dist/playwright.js +17 -82
  18. package/dist/playwright.js.map +1 -1
  19. package/dist/playwrightTest.d.ts +16 -0
  20. package/dist/playwrightTest.js +74 -0
  21. package/dist/playwrightTest.js.map +1 -0
  22. package/dist/playwrightWrapping.d.ts +2 -8
  23. package/dist/playwrightWrapping.js +212 -491
  24. package/dist/playwrightWrapping.js.map +1 -1
  25. package/dist/puppeteer.d.ts +3 -3
  26. package/dist/puppeteer.js +18 -92
  27. package/dist/puppeteer.js.map +1 -1
  28. package/dist/puppeteerWrapping.d.ts +14 -0
  29. package/dist/puppeteerWrapping.js +426 -0
  30. package/dist/puppeteerWrapping.js.map +1 -0
  31. package/dist/util.d.ts +12 -0
  32. package/dist/util.js +69 -45
  33. package/dist/util.js.map +1 -1
  34. package/dist/validateApiKey.js +6 -7
  35. package/dist/validateApiKey.js.map +1 -1
  36. package/dist/wdio.d.ts +5 -2
  37. package/dist/wdio.js +60 -147
  38. package/dist/wdio.js.map +1 -1
  39. package/dist/webdriver.d.ts +3 -3
  40. package/dist/webdriver.js +25 -85
  41. package/dist/webdriver.js.map +1 -1
  42. package/dist/webdriverWrapping.d.ts +7 -0
  43. package/dist/webdriverWrapping.js +131 -0
  44. package/dist/webdriverWrapping.js.map +1 -0
  45. package/extension/background.js +1 -1
  46. package/extension/content.js +1 -1
  47. package/extension/manifest.json +2 -3
  48. package/package.json +7 -7
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
- /* istanbul ignore file: This file is basically untestable due to how Cypress works. Instead, it's covered by our E2E suite and manual testing. */
2
+ /**
3
+ * Generated code. DO NOT EDIT DIRECTLY!
4
+ *
5
+ * See ../scripts/generateController.ts
6
+ */
3
7
  Object.defineProperty(exports, "__esModule", { value: true });
4
8
  exports.WRAPPED_COMMANDS = void 0;
5
9
  /**
@@ -10,77 +14,9 @@ exports.WRAPPED_COMMANDS = void 0;
10
14
  * As result, we need this top-level state for managing
11
15
  * analyze calls created by "wrapped" methods.
12
16
  */
13
- var isStopped = false;
14
- Cypress.Commands.add('axeFlush', function () {
15
- cy.window().then(function (win) {
16
- // @ts-expect-error `__AXE_WATCHER_HAS_VISITED` is a global set on the window by axe Watcher.
17
- // This determines if axe Watcher has ever visited the page. If it hasn't, we don't want to
18
- // flush results
19
- if (!win.__AXE_WATCHER_HAS_VISITED) {
20
- return;
21
- }
22
- return new Promise(function (resolve) {
23
- var fn = function () {
24
- win.removeEventListener('axe:flush-end', fn);
25
- // @ts-expect-error reset `__AXE_WATCHER_HAS_VISITED` to false
26
- win.__AXE_WATCHER_HAS_VISITED = false;
27
- resolve();
28
- };
29
- win.addEventListener('axe:flush-end', fn);
30
- var event = new CustomEvent('axe:flush-start');
31
- win.dispatchEvent(event);
32
- });
33
- });
34
- });
35
- Cypress.Commands.add('axeAnalyze',
36
- // __UserRequestedAnalyze allows us to differentiate between user-initiated and automatic analysis.
37
- function (_a) {
38
- var _b = _a === void 0 ? {} : _a, _c = _b.__UserRequestedAnalyze, __UserRequestedAnalyze = _c === void 0 ? true : _c;
39
- if (!__UserRequestedAnalyze && isStopped) {
40
- return;
41
- }
42
- cy.window().then(function (win) {
43
- return new Promise(function (resolve) {
44
- var event = new CustomEvent('axe:manual-mode-analyze', {
45
- detail: { userRequestedAnalyze: __UserRequestedAnalyze }
46
- });
47
- var fn = function () {
48
- win.removeEventListener('axe:manual-mode-analyze-done', fn);
49
- resolve();
50
- };
51
- win.addEventListener('axe:manual-mode-analyze-done', fn);
52
- win.dispatchEvent(event);
53
- });
54
- });
55
- });
56
- Cypress.Commands.add('axeStart', function () {
57
- cy.window().then(function (win) {
58
- return new Promise(function (resolve) {
59
- var event = new CustomEvent('axe:start-auto-mode');
60
- var fn = function () {
61
- isStopped = false;
62
- win.removeEventListener('axe:start-auto-mode-done', fn);
63
- resolve();
64
- };
65
- win.addEventListener('axe:start-auto-mode-done', fn);
66
- win.dispatchEvent(event);
67
- });
68
- });
69
- });
70
- Cypress.Commands.add('axeStop', function () {
71
- cy.window().then(function (win) {
72
- return new Promise(function (resolve) {
73
- var event = new CustomEvent('axe:stop-auto-mode');
74
- var fn = function () {
75
- isStopped = true;
76
- win.removeEventListener('axe:stop-auto-mode-done', fn);
77
- resolve();
78
- };
79
- win.addEventListener('axe:stop-auto-mode-done', fn);
80
- win.dispatchEvent(event);
81
- });
82
- });
83
- });
17
+ let isStopped = false;
18
+ /** We are running in Cypress. */
19
+ const isCypress = true;
84
20
  /** Commands we wrap to help us identify new page states. */
85
21
  exports.WRAPPED_COMMANDS = [
86
22
  'blur',
@@ -108,39 +44,36 @@ exports.WRAPPED_COMMANDS = [
108
44
  * We rely on future commands to detect any new page state created by the current command.
109
45
  * The last command that runs relies on the flush to catch the last page state.
110
46
  */
111
- exports.WRAPPED_COMMANDS.forEach(function (method) {
112
- return Cypress.Commands.overwrite(method, function (originalFn) {
113
- var _a, _b, _c;
114
- var args = [];
115
- for (var _i = 1; _i < arguments.length; _i++) {
116
- args[_i - 1] = arguments[_i];
117
- }
118
- var currentCommand = (_b = (_a = cy.state('current')) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.name;
119
- // Some commands, like "type" call other commands internally, like "click".
120
- // We don't want to enqueue a run in these scenarios because it can cause
121
- // promises to be returned from commands, which Cypress does not allow.
122
- // See: https://github.com/cypress-io/cypress/issues/19086
123
- if (currentCommand && currentCommand !== method) {
124
- return originalFn.apply(void 0, args);
47
+ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (originalFn, ...args) => {
48
+ var _a, _b, _c;
49
+ const currentCommand = (_b = (_a = cy.state('current')) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.name;
50
+ // Some commands, like "type" call other commands internally, like "click".
51
+ // We don't want to enqueue a run in these scenarios because it can cause
52
+ // promises to be returned from commands, which Cypress does not allow.
53
+ // See: https://github.com/cypress-io/cypress/issues/19086
54
+ if (currentCommand && currentCommand !== method) {
55
+ return originalFn(...args);
56
+ }
57
+ // Get the previous subject from the chain so we can pass it along to child commands.
58
+ const subject = (_c = cy.subject) === null || _c === void 0 ? void 0 : _c.call(cy);
59
+ cy.window()
60
+ .then(win => {
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ if (win && !win.__AXE_WATCHER_HAS_VISITED) {
63
+ /**
64
+ * Set a flag on the Window to indicate that a wrapped method has been called.
65
+ * This is used to determine whether we should call `axeFlush` after the test.
66
+ */
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
+ ;
69
+ win.__AXE_WATCHER_HAS_VISITED = true;
125
70
  }
126
- // Get the previous subject from the chain so we can pass it along to child commands.
127
- var subject = (_c = cy.subject) === null || _c === void 0 ? void 0 : _c.call(cy);
128
- cy.window()
129
- .then(function (win) {
130
- if (win && !win.__AXE_WATCHER_HAS_VISITED) {
131
- /**
132
- * Set a flag on the Window to indicate that a wrapped method has been called.
133
- * This is used to determine whether we should call `axeFlush` after the test.
134
- */
135
- win.__AXE_WATCHER_HAS_VISITED = true;
136
- }
137
- })
138
- .axeAnalyze({ __UserRequestedAnalyze: false })
139
- // Set the subject back to the previous subject
140
- .then(function () { return subject; })
141
- .then(function () { return originalFn.apply(void 0, args); });
142
- });
143
- });
71
+ })
72
+ .axeAnalyze({ __UserRequestedAnalyze: false })
73
+ // Set the subject back to the previous subject
74
+ .then(() => subject)
75
+ .then(() => originalFn(...args));
76
+ }));
144
77
  /**
145
78
  * The `visit` command is wrapped differently than the other commands. This is because
146
79
  * we need to actually visit and load the page before we can run axe.
@@ -148,29 +81,28 @@ exports.WRAPPED_COMMANDS.forEach(function (method) {
148
81
  * We run the original visit command, wait for the extension to be initialized, and then
149
82
  * queue an axe run.
150
83
  */
151
- Cypress.Commands.overwrite('visit', function (originalFn) {
152
- var args = [];
153
- for (var _i = 1; _i < arguments.length; _i++) {
154
- args[_i - 1] = arguments[_i];
155
- }
84
+ Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
156
85
  // We use `cy.wrap(null)` here just to get into the Cypress command queue.
157
86
  cy.wrap(null)
158
- .then(function () {
159
- return originalFn.apply(void 0, args);
87
+ .then(() => {
88
+ return originalFn(...args);
160
89
  })
161
- .then(function (visitResult) {
90
+ .then(visitResult => {
162
91
  cy.window()
163
- .then(function (win) {
92
+ .then(win => {
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
94
  if (win && !win.__AXE_WATCHER_HAS_VISITED) {
165
95
  /**
166
96
  * Set a flag on the Window to indicate that a wrapped method has been called.
167
97
  * This is used to determine whether we should call `axeFlush` after the test.
168
98
  */
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
+ ;
169
101
  win.__AXE_WATCHER_HAS_VISITED = true;
170
102
  }
171
103
  // Wait for watcher to initialize before continuing.
172
- return new Promise(function (resolve) {
173
- var fn = function () {
104
+ return new Promise(resolve => {
105
+ const fn = () => {
174
106
  win.removeEventListener('axe:initialized', fn);
175
107
  resolve();
176
108
  };
@@ -178,7 +110,85 @@ Cypress.Commands.overwrite('visit', function (originalFn) {
178
110
  });
179
111
  })
180
112
  .axeAnalyze({ __UserRequestedAnalyze: false })
181
- .then(function () { return visitResult; });
113
+ .then(() => visitResult);
114
+ });
115
+ });
116
+ Cypress.Commands.add('axeFlush', () => {
117
+ cy.window().then(win => {
118
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
119
+ const hasVisited = win.__AXE_WATCHER_HAS_VISITED;
120
+ if (isCypress && !hasVisited) {
121
+ return Promise.resolve();
122
+ }
123
+ return new Promise(resolve => {
124
+ const fn = () => {
125
+ win.removeEventListener('axe:flush-end', fn);
126
+ if (isCypress) {
127
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
+ ;
129
+ win.__AXE_WATCHER_HAS_VISITED = false;
130
+ }
131
+ resolve();
132
+ };
133
+ win.addEventListener('axe:flush-end', fn);
134
+ const event = new CustomEvent('axe:flush-start');
135
+ win.dispatchEvent(event);
136
+ });
137
+ });
138
+ });
139
+ Cypress.Commands.add('axeAnalyze',
140
+ // __UserRequestedAnalyze allows us to differentiate between user-initiated and automatic analysis.
141
+ ({ __UserRequestedAnalyze = true } = {}) => {
142
+ const userRequestedAnalyze = __UserRequestedAnalyze;
143
+ const getStopped = () => isStopped;
144
+ cy.window().then(win => {
145
+ // If the user didn't request an analyze, and we're in manual mode, don't do anything.
146
+ if (isStopped && !userRequestedAnalyze) {
147
+ return Promise.resolve();
148
+ }
149
+ return new Promise(resolve => {
150
+ const fn = () => {
151
+ win.removeEventListener('axe:manual-mode-analyze-done', fn);
152
+ resolve();
153
+ };
154
+ win.addEventListener('axe:manual-mode-analyze-done', fn);
155
+ const event = new CustomEvent('axe:manual-mode-analyze', {
156
+ detail: { userRequestedAnalyze }
157
+ });
158
+ win.dispatchEvent(event);
159
+ });
160
+ });
161
+ });
162
+ Cypress.Commands.add('axeStart', () => {
163
+ cy.window().then(win => {
164
+ const setStopped = (v) => {
165
+ isStopped = v;
166
+ };
167
+ return new Promise(resolve => {
168
+ const fn = () => {
169
+ win.removeEventListener('axe:start-auto-mode-done', fn);
170
+ resolve();
171
+ };
172
+ win.addEventListener('axe:start-auto-mode-done', fn);
173
+ const event = new CustomEvent('axe:start-auto-mode');
174
+ win.dispatchEvent(event);
175
+ });
176
+ });
177
+ });
178
+ Cypress.Commands.add('axeStop', () => {
179
+ cy.window().then(win => {
180
+ const setStopped = (v) => {
181
+ isStopped = v;
182
+ };
183
+ return new Promise(resolve => {
184
+ const fn = () => {
185
+ win.removeEventListener('axe:stop-auto-mode-done', fn);
186
+ resolve();
187
+ };
188
+ win.addEventListener('axe:stop-auto-mode-done', fn);
189
+ const event = new CustomEvent('axe:stop-auto-mode');
190
+ win.dispatchEvent(event);
191
+ });
182
192
  });
183
193
  });
184
194
  //# sourceMappingURL=cypressCommands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";AAAA,kJAAkJ;;;AAmClJ;;;;;;;GAOG;AAEH,IAAI,SAAS,GAAG,KAAK,CAAA;AAErB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE;IAC/B,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG;QAClB,6FAA6F;QAC7F,2FAA2F;QAC3F,gBAAgB;QAChB,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE;YAClC,OAAM;SACP;QAED,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;YAC9B,IAAM,EAAE,GAAG;gBACT,GAAG,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;gBAC5C,8DAA8D;gBAC9D,GAAG,CAAC,yBAAyB,GAAG,KAAK,CAAA;gBACrC,OAAO,EAAE,CAAA;YACX,CAAC,CAAA;YACD,GAAG,CAAC,gBAAgB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;YACzC,IAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAA;YAChD,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAA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,CAAA;gBACvD,OAAO,EAAE,CAAA;YACX,CAAC,CAAA;YACD,GAAG,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAA;YACpD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAA;YACpD,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC1B,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,MAAM,UAAU,GAAG,CAAC,CAAU,EAAQ,EAAE;YACtC,SAAS,GAAG,CAAC,CAAA;QACf,CAAC,CAAA;QAED,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,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/dist/git.d.ts CHANGED
@@ -21,4 +21,6 @@ interface CommitInfo {
21
21
  export declare const getCommitInfo: (dir?: string) => CommitInfo | null;
22
22
  /** Check if the repository contains unstaged changes. */
23
23
  export declare const isDirty: (dir?: string) => boolean;
24
+ /** Get the tag name. */
25
+ export declare const getTag: (dir?: string) => string | null;
24
26
  export {};
package/dist/git.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDirty = exports.getCommitInfo = exports.getRemoteURL = exports.parseDefaultFromShowRemoteOutput = exports.getDefaultBranchName = exports.getBranchName = exports.isRepository = void 0;
4
- var child_process_1 = require("child_process");
3
+ exports.getTag = exports.isDirty = exports.getCommitInfo = exports.getRemoteURL = exports.parseDefaultFromShowRemoteOutput = exports.getDefaultBranchName = exports.getBranchName = exports.isRepository = void 0;
4
+ const child_process_1 = require("child_process");
5
5
  /** Check if the given `dir` is contained by a Git repository. */
6
- var isRepository = function (dir) {
7
- if (dir === void 0) { dir = process.cwd(); }
6
+ const isRepository = (dir = process.cwd()) => {
8
7
  try {
9
8
  (0, child_process_1.execSync)('git rev-parse --is-inside-work-tree', {
10
9
  cwd: dir,
@@ -19,8 +18,7 @@ var isRepository = function (dir) {
19
18
  };
20
19
  exports.isRepository = isRepository;
21
20
  /** Get the current branch name. */
22
- var getBranchName = function (dir) {
23
- if (dir === void 0) { dir = process.cwd(); }
21
+ const getBranchName = (dir = process.cwd()) => {
24
22
  try {
25
23
  return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', {
26
24
  cwd: dir,
@@ -36,10 +34,9 @@ var getBranchName = function (dir) {
36
34
  };
37
35
  exports.getBranchName = getBranchName;
38
36
  /** Get the default branch name. */
39
- var getDefaultBranchName = function (dir) {
40
- if (dir === void 0) { dir = process.cwd(); }
37
+ const getDefaultBranchName = (dir = process.cwd()) => {
41
38
  try {
42
- var stdout = (0, child_process_1.execSync)('git remote show origin', {
39
+ const stdout = (0, child_process_1.execSync)('git remote show origin', {
43
40
  cwd: dir,
44
41
  stdio: ['ignore', 'pipe', 'ignore']
45
42
  }).toString();
@@ -54,14 +51,13 @@ exports.getDefaultBranchName = getDefaultBranchName;
54
51
  * Parse the default branch name from the output of `git remote show origin`.
55
52
  * @private Exported only for testing.
56
53
  */
57
- var parseDefaultFromShowRemoteOutput = function (output) {
58
- var match = /HEAD branch:\s(.*)/.exec(output);
54
+ const parseDefaultFromShowRemoteOutput = (output) => {
55
+ const match = /HEAD branch:\s(.*)/.exec(output);
59
56
  return match ? match[1].trim() : null;
60
57
  };
61
58
  exports.parseDefaultFromShowRemoteOutput = parseDefaultFromShowRemoteOutput;
62
59
  /** Get the repository's remote URL. */
63
- var getRemoteURL = function (dir) {
64
- if (dir === void 0) { dir = process.cwd(); }
60
+ const getRemoteURL = (dir = process.cwd()) => {
65
61
  try {
66
62
  return (0, child_process_1.execSync)('git config --get remote.origin.url', {
67
63
  cwd: dir,
@@ -76,28 +72,26 @@ var getRemoteURL = function (dir) {
76
72
  };
77
73
  exports.getRemoteURL = getRemoteURL;
78
74
  /** Get info on the most recent commit. */
79
- var getCommitInfo = function (dir) {
80
- if (dir === void 0) { dir = process.cwd(); }
75
+ const getCommitInfo = (dir = process.cwd()) => {
81
76
  try {
82
77
  // %s=subject (message), %H=hash, %an=author name, %ae=author email, %n=newline
83
78
  // See https://git-scm.com/docs/git-show#_pretty_formats
84
- var stdout = (0, child_process_1.execSync)('git show --no-patch --format="%s%n%H%n%an%n%ae"', {
79
+ const stdout = (0, child_process_1.execSync)('git show --no-patch --format="%s%n%H%n%an%n%ae"', {
85
80
  cwd: dir,
86
81
  stdio: ['ignore', 'pipe', 'ignore']
87
82
  });
88
- var _a = stdout.toString().trim().split('\n'), message = _a[0], hash = _a[1], author = _a[2], email = _a[3];
89
- return { message: message, hash: hash, author: author, email: email };
83
+ const [message, hash, author, email] = stdout.toString().trim().split('\n');
84
+ return { message, hash, author, email };
90
85
  }
91
- catch (_b) {
86
+ catch (_a) {
92
87
  return null;
93
88
  }
94
89
  };
95
90
  exports.getCommitInfo = getCommitInfo;
96
91
  /** Check if the repository contains unstaged changes. */
97
- var isDirty = function (dir) {
98
- if (dir === void 0) { dir = process.cwd(); }
92
+ const isDirty = (dir = process.cwd()) => {
99
93
  try {
100
- var stdout = (0, child_process_1.execSync)('git status --short', {
94
+ const stdout = (0, child_process_1.execSync)('git status --short', {
101
95
  cwd: dir,
102
96
  stdio: ['ignore', 'pipe', 'ignore']
103
97
  });
@@ -108,4 +102,19 @@ var isDirty = function (dir) {
108
102
  }
109
103
  };
110
104
  exports.isDirty = isDirty;
105
+ /** Get the tag name. */
106
+ const getTag = (dir = process.cwd()) => {
107
+ try {
108
+ return (0, child_process_1.execSync)('git describe --tags --exact', {
109
+ cwd: dir,
110
+ stdio: ['ignore', 'pipe', 'ignore']
111
+ })
112
+ .toString()
113
+ .trim();
114
+ }
115
+ catch (_a) {
116
+ return null;
117
+ }
118
+ };
119
+ exports.getTag = getTag;
111
120
  //# sourceMappingURL=git.js.map
package/dist/git.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,iEAAiE;AAC1D,IAAM,YAAY,GAAG,UAAC,GAAmB;IAAnB,oBAAA,EAAA,MAAM,OAAO,CAAC,GAAG,EAAE;IAC9C,IAAI;QACF,IAAA,wBAAQ,EAAC,qCAAqC,EAAE;YAC9C,GAAG,EAAE,GAAG;YACR,kDAAkD;YAClD,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;KACZ;IAAC,WAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB;AAED,mCAAmC;AAC5B,IAAM,aAAa,GAAG,UAAC,GAAmB;IAAnB,oBAAA,EAAA,MAAM,OAAO,CAAC,GAAG,EAAE;IAC/C,IAAI;QACF,OAAO,IAAA,wBAAQ,EAAC,iCAAiC,EAAE;YACjD,GAAG,EAAE,GAAG;YACR,4EAA4E;YAC5E,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC;aACC,QAAQ,EAAE;aACV,IAAI,EAAE,CAAA;KACV;IAAC,WAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAZY,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AAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;KACzB;IAAC,WAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAVY,QAAA,OAAO,WAUnB;AAED,wBAAwB;AACjB,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAiB,EAAE;IAC3D,IAAI;QACF,OAAO,IAAA,wBAAQ,EAAC,6BAA6B,EAAE;YAC7C,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC;aACC,QAAQ,EAAE;aACV,IAAI,EAAE,CAAA;KACV;IAAC,WAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /*! Copyright Deque 2021-2022 All Rights Reserved */
2
- export { puppeteerConfig, PuppeteerController } from './puppeteer';
2
+ export { puppeteerConfig, PuppeteerController, wrapPuppeteer } from './puppeteer';
3
3
  export { wdioConfig, wdioTestRunner, WdioController, wrapWdio } from './wdio';
4
- export { webdriverConfig, WebdriverController } from './webdriver';
4
+ export { webdriverConfig, WebdriverController, wrapWebdriver } from './webdriver';
5
5
  export { playwrightConfig, PlaywrightController, wrapPlaywright } from './playwright';
6
+ export { default as playwrightTest } from './playwrightTest';
6
7
  export { cypressConfig } from './cypress';
package/dist/index.js CHANGED
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  /*! Copyright Deque 2021-2022 All Rights Reserved */
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.cypressConfig = exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = exports.WebdriverController = exports.webdriverConfig = exports.wrapWdio = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = exports.PuppeteerController = exports.puppeteerConfig = void 0;
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;
5
8
  var puppeteer_1 = require("./puppeteer");
6
9
  Object.defineProperty(exports, "puppeteerConfig", { enumerable: true, get: function () { return puppeteer_1.puppeteerConfig; } });
7
10
  Object.defineProperty(exports, "PuppeteerController", { enumerable: true, get: function () { return puppeteer_1.PuppeteerController; } });
11
+ Object.defineProperty(exports, "wrapPuppeteer", { enumerable: true, get: function () { return puppeteer_1.wrapPuppeteer; } });
8
12
  var wdio_1 = require("./wdio");
9
13
  Object.defineProperty(exports, "wdioConfig", { enumerable: true, get: function () { return wdio_1.wdioConfig; } });
10
14
  Object.defineProperty(exports, "wdioTestRunner", { enumerable: true, get: function () { return wdio_1.wdioTestRunner; } });
@@ -13,10 +17,13 @@ Object.defineProperty(exports, "wrapWdio", { enumerable: true, get: function ()
13
17
  var webdriver_1 = require("./webdriver");
14
18
  Object.defineProperty(exports, "webdriverConfig", { enumerable: true, get: function () { return webdriver_1.webdriverConfig; } });
15
19
  Object.defineProperty(exports, "WebdriverController", { enumerable: true, get: function () { return webdriver_1.WebdriverController; } });
20
+ Object.defineProperty(exports, "wrapWebdriver", { enumerable: true, get: function () { return webdriver_1.wrapWebdriver; } });
16
21
  var playwright_1 = require("./playwright");
17
22
  Object.defineProperty(exports, "playwrightConfig", { enumerable: true, get: function () { return playwright_1.playwrightConfig; } });
18
23
  Object.defineProperty(exports, "PlaywrightController", { enumerable: true, get: function () { return playwright_1.PlaywrightController; } });
19
24
  Object.defineProperty(exports, "wrapPlaywright", { enumerable: true, get: function () { return playwright_1.wrapPlaywright; } });
25
+ var playwrightTest_1 = require("./playwrightTest");
26
+ Object.defineProperty(exports, "playwrightTest", { enumerable: true, get: function () { return __importDefault(playwrightTest_1).default; } });
20
27
  var cypress_1 = require("./cypress");
21
28
  Object.defineProperty(exports, "cypressConfig", { enumerable: true, get: function () { return cypress_1.cypressConfig; } });
22
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,yCAAkE;AAAzD,4GAAA,eAAe,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAC7C,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAAkE;AAAzD,4GAAA,eAAe,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAC7C,2CAIqB;AAHnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AAEhB,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
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,16 +1,18 @@
1
- import type { LaunchOptions, Page } from 'playwright';
2
- import { Configuration } from './util';
1
+ import type { LaunchOptions, Page } from 'playwright-core';
2
+ import { type Configuration } from './util';
3
3
  import Controller from './Controller';
4
4
  import { wrapBrowserContext } from './playwrightWrapping';
5
+ /** Options for configuring Playwright and @axe-core/watcher. */
6
+ export declare type Options = Configuration & LaunchOptions;
5
7
  /**
6
8
  * Creates a Playwright config that uses axe extension
7
9
  *
8
10
  * @param opts Playwright config to extend
9
11
  */
10
- export declare function playwrightConfig(opts: Configuration & LaunchOptions): LaunchOptions;
12
+ export declare function playwrightConfig(opts: Options): LaunchOptions;
11
13
  export declare class PlaywrightController extends Controller {
12
14
  private driver;
13
15
  constructor(driver: Page);
14
- protected executeScript(fn: string | (() => Promise<void>), ...args: unknown[]): Promise<void>;
16
+ protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;
15
17
  }
16
18
  export { wrapBrowserContext as wrapPlaywright };