@stencil/core 4.18.3 → 4.19.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.
Files changed (47) hide show
  1. package/cli/index.cjs +43 -16
  2. package/cli/index.js +43 -16
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +175 -72
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +3 -3
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/dev-server/ws.js +1 -1
  13. package/internal/app-data/package.json +1 -1
  14. package/internal/client/index.js +534 -507
  15. package/internal/client/package.json +3 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +108 -50
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.d.ts +29 -11
  20. package/internal/hydrate/runner.js +239 -260
  21. package/internal/package.json +1 -1
  22. package/internal/stencil-private.d.ts +39 -14
  23. package/internal/stencil-public-compiler.d.ts +21 -0
  24. package/internal/stencil-public-runtime.d.ts +0 -2
  25. package/internal/testing/index.js +439 -407
  26. package/internal/testing/package.json +1 -1
  27. package/mock-doc/index.cjs +137 -131
  28. package/mock-doc/index.d.ts +18 -4
  29. package/mock-doc/index.js +137 -131
  30. package/mock-doc/package.json +1 -1
  31. package/package.json +34 -6
  32. package/screenshot/index.js +1 -1
  33. package/screenshot/package.json +1 -1
  34. package/screenshot/pixel-match.js +1 -1
  35. package/sys/node/index.js +10 -10
  36. package/sys/node/package.json +1 -1
  37. package/sys/node/worker.js +1 -1
  38. package/testing/index.js +95 -16
  39. package/testing/jest/jest-27-and-under/matchers/events.d.ts +4 -0
  40. package/testing/jest/jest-27-and-under/matchers/index.d.ts +2 -1
  41. package/testing/jest/jest-28/matchers/events.d.ts +4 -0
  42. package/testing/jest/jest-28/matchers/index.d.ts +2 -1
  43. package/testing/jest/jest-29/matchers/events.d.ts +4 -0
  44. package/testing/jest/jest-29/matchers/index.d.ts +2 -1
  45. package/testing/mocks.d.ts +9 -9
  46. package/testing/package.json +1 -1
  47. package/testing/puppeteer/puppeteer-declarations.d.ts +11 -0
package/testing/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Testing v4.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Testing v4.19.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
 
@@ -1771,6 +1771,7 @@ function createJestPuppeteerEnvironment() {
1771
1771
  if (!this.browser) {
1772
1772
  this.browser = await connectBrowser();
1773
1773
  }
1774
+ await this.closeOpenPages();
1774
1775
  const page = await newBrowserPage(this.browser);
1775
1776
  this.pages.push(page);
1776
1777
  const env2 = process.env;
@@ -1780,7 +1781,7 @@ function createJestPuppeteerEnvironment() {
1780
1781
  return page;
1781
1782
  }
1782
1783
  async closeOpenPages() {
1783
- await Promise.all(this.pages.map((page) => page.close()));
1784
+ await Promise.all(this.pages.filter((page) => !page.isClosed()).map((page) => page.close()));
1784
1785
  this.pages.length = 0;
1785
1786
  }
1786
1787
  async teardown() {
@@ -3342,6 +3343,26 @@ function toHaveFirstReceivedEventDetail(eventSpy, eventDetail) {
3342
3343
  throw new Error(`event "${eventSpy.eventName}" was not received`);
3343
3344
  }
3344
3345
  const pass = deepEqual(eventSpy.firstEvent.detail, eventDetail);
3346
+ expect(eventSpy.firstEvent.detail).toEqual(eventDetail);
3347
+ return {
3348
+ message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
3349
+ pass
3350
+ };
3351
+ }
3352
+ function toHaveLastReceivedEventDetail(eventSpy, eventDetail) {
3353
+ if (!eventSpy) {
3354
+ throw new Error(`toHaveLastReceivedEventDetail event spy is null`);
3355
+ }
3356
+ if (typeof eventSpy.then === "function") {
3357
+ throw new Error(`event spy must be a resolved value, not a promise, before it can be tested`);
3358
+ }
3359
+ if (!eventSpy.eventName) {
3360
+ throw new Error(`toHaveLastReceivedEventDetail did not receive an event spy`);
3361
+ }
3362
+ if (!eventSpy.firstEvent) {
3363
+ throw new Error(`event "${eventSpy.eventName}" was not received`);
3364
+ }
3365
+ const pass = deepEqual(eventSpy.lastEvent.detail, eventDetail);
3345
3366
  expect(eventSpy.lastEvent.detail).toEqual(eventDetail);
3346
3367
  return {
3347
3368
  message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
@@ -3567,6 +3588,7 @@ var expectExtend = {
3567
3588
  toHaveReceivedEventDetail,
3568
3589
  toHaveReceivedEventTimes,
3569
3590
  toHaveFirstReceivedEventDetail,
3591
+ toHaveLastReceivedEventDetail,
3570
3592
  toHaveNthReceivedEventDetail,
3571
3593
  toMatchScreenshot
3572
3594
  };
@@ -3586,15 +3608,17 @@ function jestSetupTestFramework() {
3586
3608
  });
3587
3609
  afterEach(async () => {
3588
3610
  var _a, _b, _c, _d, _e, _f;
3589
- if (global.__CLOSE_OPEN_PAGES__) {
3590
- await global.__CLOSE_OPEN_PAGES__();
3591
- }
3592
3611
  (0, import_testing.stopAutoApplyChanges)();
3593
3612
  const bodyNode = (_e = (_d = (_c = (_b = (_a = global.window) == null ? void 0 : _a.document) == null ? void 0 : _b.childNodes) == null ? void 0 : _c[1]) == null ? void 0 : _d.childNodes) == null ? void 0 : _e.find((ref) => ref.nodeName === "BODY");
3594
3613
  (_f = bodyNode == null ? void 0 : bodyNode.childNodes) == null ? void 0 : _f.forEach(removeDomNodes);
3595
3614
  (0, import_mock_doc7.teardownGlobal)(global);
3596
3615
  global.resourcesUrl = "/build";
3597
3616
  });
3617
+ afterAll(async () => {
3618
+ if (global.__CLOSE_OPEN_PAGES__) {
3619
+ await global.__CLOSE_OPEN_PAGES__();
3620
+ }
3621
+ });
3598
3622
  const jasmineEnv = jasmine.getEnv();
3599
3623
  if (jasmineEnv != null) {
3600
3624
  jasmineEnv.addReporter({
@@ -3701,6 +3725,7 @@ function createJestPuppeteerEnvironment2() {
3701
3725
  if (!this.browser) {
3702
3726
  this.browser = await connectBrowser();
3703
3727
  }
3728
+ await this.closeOpenPages();
3704
3729
  const page = await newBrowserPage(this.browser);
3705
3730
  this.pages.push(page);
3706
3731
  const env2 = process.env;
@@ -3710,7 +3735,7 @@ function createJestPuppeteerEnvironment2() {
3710
3735
  return page;
3711
3736
  }
3712
3737
  async closeOpenPages() {
3713
- await Promise.all(this.pages.map((page) => page.close()));
3738
+ await Promise.all(this.pages.filter((page) => !page.isClosed()).map((page) => page.close()));
3714
3739
  this.pages.length = 0;
3715
3740
  }
3716
3741
  async teardown() {
@@ -4351,6 +4376,26 @@ function toHaveFirstReceivedEventDetail2(eventSpy, eventDetail) {
4351
4376
  throw new Error(`event "${eventSpy.eventName}" was not received`);
4352
4377
  }
4353
4378
  const pass = deepEqual2(eventSpy.firstEvent.detail, eventDetail);
4379
+ expect(eventSpy.firstEvent.detail).toEqual(eventDetail);
4380
+ return {
4381
+ message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
4382
+ pass
4383
+ };
4384
+ }
4385
+ function toHaveLastReceivedEventDetail2(eventSpy, eventDetail) {
4386
+ if (!eventSpy) {
4387
+ throw new Error(`toHaveLastReceivedEventDetail event spy is null`);
4388
+ }
4389
+ if (typeof eventSpy.then === "function") {
4390
+ throw new Error(`event spy must be a resolved value, not a promise, before it can be tested`);
4391
+ }
4392
+ if (!eventSpy.eventName) {
4393
+ throw new Error(`toHaveLastReceivedEventDetail did not receive an event spy`);
4394
+ }
4395
+ if (!eventSpy.firstEvent) {
4396
+ throw new Error(`event "${eventSpy.eventName}" was not received`);
4397
+ }
4398
+ const pass = deepEqual2(eventSpy.lastEvent.detail, eventDetail);
4354
4399
  expect(eventSpy.lastEvent.detail).toEqual(eventDetail);
4355
4400
  return {
4356
4401
  message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
@@ -4576,6 +4621,7 @@ var expectExtend2 = {
4576
4621
  toHaveReceivedEventDetail: toHaveReceivedEventDetail2,
4577
4622
  toHaveReceivedEventTimes: toHaveReceivedEventTimes2,
4578
4623
  toHaveFirstReceivedEventDetail: toHaveFirstReceivedEventDetail2,
4624
+ toHaveLastReceivedEventDetail: toHaveLastReceivedEventDetail2,
4579
4625
  toHaveNthReceivedEventDetail: toHaveNthReceivedEventDetail2,
4580
4626
  toMatchScreenshot: toMatchScreenshot2
4581
4627
  };
@@ -4595,15 +4641,17 @@ function jestSetupTestFramework2() {
4595
4641
  });
4596
4642
  afterEach(async () => {
4597
4643
  var _a, _b, _c, _d, _e, _f;
4598
- if (global.__CLOSE_OPEN_PAGES__) {
4599
- await global.__CLOSE_OPEN_PAGES__();
4600
- }
4601
4644
  (0, import_testing2.stopAutoApplyChanges)();
4602
4645
  const bodyNode = (_e = (_d = (_c = (_b = (_a = global.window) == null ? void 0 : _a.document) == null ? void 0 : _b.childNodes) == null ? void 0 : _c[1]) == null ? void 0 : _d.childNodes) == null ? void 0 : _e.find((ref) => ref.nodeName === "BODY");
4603
4646
  (_f = bodyNode == null ? void 0 : bodyNode.childNodes) == null ? void 0 : _f.forEach(removeDomNodes2);
4604
4647
  (0, import_mock_doc12.teardownGlobal)(global);
4605
4648
  global.resourcesUrl = "/build";
4606
4649
  });
4650
+ afterAll(async () => {
4651
+ if (global.__CLOSE_OPEN_PAGES__) {
4652
+ await global.__CLOSE_OPEN_PAGES__();
4653
+ }
4654
+ });
4607
4655
  global.screenshotDescriptions = /* @__PURE__ */ new Set();
4608
4656
  const env2 = process.env;
4609
4657
  if (typeof env2.__STENCIL_DEFAULT_TIMEOUT__ === "string") {
@@ -4701,6 +4749,7 @@ function createJestPuppeteerEnvironment3() {
4701
4749
  if (!this.browser) {
4702
4750
  this.browser = await connectBrowser();
4703
4751
  }
4752
+ await this.closeOpenPages();
4704
4753
  const page = await newBrowserPage(this.browser);
4705
4754
  this.pages.push(page);
4706
4755
  const env2 = process.env;
@@ -4710,7 +4759,7 @@ function createJestPuppeteerEnvironment3() {
4710
4759
  return page;
4711
4760
  }
4712
4761
  async closeOpenPages() {
4713
- await Promise.all(this.pages.map((page) => page.close()));
4762
+ await Promise.all(this.pages.filter((page) => !page.isClosed()).map((page) => page.close()));
4714
4763
  this.pages.length = 0;
4715
4764
  }
4716
4765
  async teardown() {
@@ -5351,6 +5400,26 @@ function toHaveFirstReceivedEventDetail3(eventSpy, eventDetail) {
5351
5400
  throw new Error(`event "${eventSpy.eventName}" was not received`);
5352
5401
  }
5353
5402
  const pass = deepEqual3(eventSpy.firstEvent.detail, eventDetail);
5403
+ expect(eventSpy.firstEvent.detail).toEqual(eventDetail);
5404
+ return {
5405
+ message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
5406
+ pass
5407
+ };
5408
+ }
5409
+ function toHaveLastReceivedEventDetail3(eventSpy, eventDetail) {
5410
+ if (!eventSpy) {
5411
+ throw new Error(`toHaveLastReceivedEventDetail event spy is null`);
5412
+ }
5413
+ if (typeof eventSpy.then === "function") {
5414
+ throw new Error(`event spy must be a resolved value, not a promise, before it can be tested`);
5415
+ }
5416
+ if (!eventSpy.eventName) {
5417
+ throw new Error(`toHaveLastReceivedEventDetail did not receive an event spy`);
5418
+ }
5419
+ if (!eventSpy.firstEvent) {
5420
+ throw new Error(`event "${eventSpy.eventName}" was not received`);
5421
+ }
5422
+ const pass = deepEqual3(eventSpy.lastEvent.detail, eventDetail);
5354
5423
  expect(eventSpy.lastEvent.detail).toEqual(eventDetail);
5355
5424
  return {
5356
5425
  message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
@@ -5576,6 +5645,7 @@ var expectExtend3 = {
5576
5645
  toHaveReceivedEventDetail: toHaveReceivedEventDetail3,
5577
5646
  toHaveReceivedEventTimes: toHaveReceivedEventTimes3,
5578
5647
  toHaveFirstReceivedEventDetail: toHaveFirstReceivedEventDetail3,
5648
+ toHaveLastReceivedEventDetail: toHaveLastReceivedEventDetail3,
5579
5649
  toHaveNthReceivedEventDetail: toHaveNthReceivedEventDetail3,
5580
5650
  toMatchScreenshot: toMatchScreenshot3
5581
5651
  };
@@ -5595,15 +5665,17 @@ function jestSetupTestFramework3() {
5595
5665
  });
5596
5666
  afterEach(async () => {
5597
5667
  var _a, _b, _c, _d, _e, _f;
5598
- if (global.__CLOSE_OPEN_PAGES__) {
5599
- await global.__CLOSE_OPEN_PAGES__();
5600
- }
5601
5668
  (0, import_testing3.stopAutoApplyChanges)();
5602
5669
  const bodyNode = (_e = (_d = (_c = (_b = (_a = global.window) == null ? void 0 : _a.document) == null ? void 0 : _b.childNodes) == null ? void 0 : _c[1]) == null ? void 0 : _d.childNodes) == null ? void 0 : _e.find((ref) => ref.nodeName === "BODY");
5603
5670
  (_f = bodyNode == null ? void 0 : bodyNode.childNodes) == null ? void 0 : _f.forEach(removeDomNodes3);
5604
5671
  (0, import_mock_doc17.teardownGlobal)(global);
5605
5672
  global.resourcesUrl = "/build";
5606
5673
  });
5674
+ afterAll(async () => {
5675
+ if (global.__CLOSE_OPEN_PAGES__) {
5676
+ await global.__CLOSE_OPEN_PAGES__();
5677
+ }
5678
+ });
5607
5679
  global.screenshotDescriptions = /* @__PURE__ */ new Set();
5608
5680
  const env2 = process.env;
5609
5681
  if (typeof env2.__STENCIL_DEFAULT_TIMEOUT__ === "string") {
@@ -6684,7 +6756,7 @@ var validateRollupConfig = (config) => {
6684
6756
  if (rollupConfig.inputOptions && isObject(rollupConfig.inputOptions)) {
6685
6757
  cleanRollupConfig = {
6686
6758
  ...cleanRollupConfig,
6687
- inputOptions: pluck(rollupConfig.inputOptions, ["context", "moduleContext", "treeshake"])
6759
+ inputOptions: pluck(rollupConfig.inputOptions, ["context", "moduleContext", "treeshake", "external"])
6688
6760
  };
6689
6761
  }
6690
6762
  if (rollupConfig.outputOptions && isObject(rollupConfig.outputOptions)) {
@@ -6954,6 +7026,7 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
6954
7026
  devMode,
6955
7027
  extras: config.extras || {},
6956
7028
  flags,
7029
+ generateExportMaps: isBoolean(config.generateExportMaps) ? config.generateExportMaps : false,
6957
7030
  hashFileNames,
6958
7031
  hashedFileNameLength: (_c = config.hashedFileNameLength) != null ? _c : DEFAULT_HASHED_FILENAME_LENGTH,
6959
7032
  hydratedFlag: validateHydrated(config),
@@ -9714,6 +9787,9 @@ var E2EElement = class extends import_mock_doc19.MockHTMLElement {
9714
9787
  }
9715
9788
  const frag = (0, import_mock_doc19.parseHtmlToFragment)(outerHTML);
9716
9789
  const rootElm = frag.firstElementChild;
9790
+ if (!rootElm) {
9791
+ return;
9792
+ }
9717
9793
  this.nodeName = rootElm.nodeName;
9718
9794
  this.attributes = (0, import_mock_doc19.cloneAttributes)(rootElm.attributes);
9719
9795
  while (this.childNodes.length > 0) {
@@ -10152,6 +10228,7 @@ function createPuppeteerScreenshotOptions(opts, { width, height }) {
10152
10228
  encoding: "binary"
10153
10229
  };
10154
10230
  if (opts.clip) {
10231
+ puppeteerOpts.captureBeyondViewport = typeof opts.captureBeyondViewport === "boolean" ? opts.captureBeyondViewport : true;
10155
10232
  puppeteerOpts.clip = {
10156
10233
  x: opts.clip.x,
10157
10234
  y: opts.clip.y,
@@ -10159,6 +10236,7 @@ function createPuppeteerScreenshotOptions(opts, { width, height }) {
10159
10236
  height: opts.clip.height
10160
10237
  };
10161
10238
  } else {
10239
+ puppeteerOpts.captureBeyondViewport = typeof opts.captureBeyondViewport === "boolean" ? opts.captureBeyondViewport : false;
10162
10240
  puppeteerOpts.clip = {
10163
10241
  x: 0,
10164
10242
  y: 0,
@@ -10257,6 +10335,7 @@ async function newE2EPage(opts = {}) {
10257
10335
  };
10258
10336
  const failOnConsoleError = opts.failOnConsoleError === true;
10259
10337
  const failOnNetworkError = opts.failOnNetworkError === true;
10338
+ const logFailingNetworkRequests = typeof opts.logFailingNetworkRequests === "boolean" ? opts.logFailingNetworkRequests : true;
10260
10339
  page.on("console", (ev) => {
10261
10340
  if (ev.type() === "error") {
10262
10341
  diagnostics.push({
@@ -10286,7 +10365,7 @@ async function newE2EPage(opts = {}) {
10286
10365
  });
10287
10366
  if (failOnNetworkError) {
10288
10367
  throw new Error(req.failure().errorText);
10289
- } else {
10368
+ } else if (logFailingNetworkRequests) {
10290
10369
  console.error("requestfailed", req.url());
10291
10370
  }
10292
10371
  });
@@ -10508,7 +10587,7 @@ var getBuildFeatures = (cmps) => {
10508
10587
  member: cmps.some((c) => c.hasMember),
10509
10588
  method: cmps.some((c) => c.hasMethod),
10510
10589
  mode: cmps.some((c) => c.hasMode),
10511
- observeAttribute: cmps.some((c) => c.hasAttribute),
10590
+ observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback),
10512
10591
  prop: cmps.some((c) => c.hasProp),
10513
10592
  propBoolean: cmps.some((c) => c.hasPropBoolean),
10514
10593
  propNumber: cmps.some((c) => c.hasPropNumber),
@@ -15,6 +15,10 @@ export declare function toHaveFirstReceivedEventDetail(eventSpy: d.EventSpy, eve
15
15
  message: () => string;
16
16
  pass: boolean;
17
17
  };
18
+ export declare function toHaveLastReceivedEventDetail(eventSpy: d.EventSpy, eventDetail: any): {
19
+ message: () => string;
20
+ pass: boolean;
21
+ };
18
22
  export declare function toHaveNthReceivedEventDetail(eventSpy: d.EventSpy, index: number, eventDetail: any): {
19
23
  message: () => string;
20
24
  pass: boolean;
@@ -1,6 +1,6 @@
1
1
  import { toEqualAttribute, toEqualAttributes, toHaveAttribute } from './attributes';
2
2
  import { toHaveClass, toHaveClasses, toMatchClasses } from './class-list';
3
- import { toHaveFirstReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
3
+ import { toHaveFirstReceivedEventDetail, toHaveLastReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
4
4
  import { toEqualHtml, toEqualLightHtml } from './html';
5
5
  import { toMatchScreenshot } from './screenshot';
6
6
  import { toEqualText } from './text';
@@ -18,6 +18,7 @@ export declare const expectExtend: {
18
18
  toHaveReceivedEventDetail: typeof toHaveReceivedEventDetail;
19
19
  toHaveReceivedEventTimes: typeof toHaveReceivedEventTimes;
20
20
  toHaveFirstReceivedEventDetail: typeof toHaveFirstReceivedEventDetail;
21
+ toHaveLastReceivedEventDetail: typeof toHaveLastReceivedEventDetail;
21
22
  toHaveNthReceivedEventDetail: typeof toHaveNthReceivedEventDetail;
22
23
  toMatchScreenshot: typeof toMatchScreenshot;
23
24
  };
@@ -15,6 +15,10 @@ export declare function toHaveFirstReceivedEventDetail(eventSpy: d.EventSpy, eve
15
15
  message: () => string;
16
16
  pass: boolean;
17
17
  };
18
+ export declare function toHaveLastReceivedEventDetail(eventSpy: d.EventSpy, eventDetail: any): {
19
+ message: () => string;
20
+ pass: boolean;
21
+ };
18
22
  export declare function toHaveNthReceivedEventDetail(eventSpy: d.EventSpy, index: number, eventDetail: any): {
19
23
  message: () => string;
20
24
  pass: boolean;
@@ -1,6 +1,6 @@
1
1
  import { toEqualAttribute, toEqualAttributes, toHaveAttribute } from './attributes';
2
2
  import { toHaveClass, toHaveClasses, toMatchClasses } from './class-list';
3
- import { toHaveFirstReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
3
+ import { toHaveFirstReceivedEventDetail, toHaveLastReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
4
4
  import { toEqualHtml, toEqualLightHtml } from './html';
5
5
  import { toMatchScreenshot } from './screenshot';
6
6
  import { toEqualText } from './text';
@@ -18,6 +18,7 @@ export declare const expectExtend: {
18
18
  toHaveReceivedEventDetail: typeof toHaveReceivedEventDetail;
19
19
  toHaveReceivedEventTimes: typeof toHaveReceivedEventTimes;
20
20
  toHaveFirstReceivedEventDetail: typeof toHaveFirstReceivedEventDetail;
21
+ toHaveLastReceivedEventDetail: typeof toHaveLastReceivedEventDetail;
21
22
  toHaveNthReceivedEventDetail: typeof toHaveNthReceivedEventDetail;
22
23
  toMatchScreenshot: typeof toMatchScreenshot;
23
24
  };
@@ -15,6 +15,10 @@ export declare function toHaveFirstReceivedEventDetail(eventSpy: d.EventSpy, eve
15
15
  message: () => string;
16
16
  pass: boolean;
17
17
  };
18
+ export declare function toHaveLastReceivedEventDetail(eventSpy: d.EventSpy, eventDetail: any): {
19
+ message: () => string;
20
+ pass: boolean;
21
+ };
18
22
  export declare function toHaveNthReceivedEventDetail(eventSpy: d.EventSpy, index: number, eventDetail: any): {
19
23
  message: () => string;
20
24
  pass: boolean;
@@ -1,6 +1,6 @@
1
1
  import { toEqualAttribute, toEqualAttributes, toHaveAttribute } from './attributes';
2
2
  import { toHaveClass, toHaveClasses, toMatchClasses } from './class-list';
3
- import { toHaveFirstReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
3
+ import { toHaveFirstReceivedEventDetail, toHaveLastReceivedEventDetail, toHaveNthReceivedEventDetail, toHaveReceivedEvent, toHaveReceivedEventDetail, toHaveReceivedEventTimes } from './events';
4
4
  import { toEqualHtml, toEqualLightHtml } from './html';
5
5
  import { toMatchScreenshot } from './screenshot';
6
6
  import { toEqualText } from './text';
@@ -18,6 +18,7 @@ export declare const expectExtend: {
18
18
  toHaveReceivedEventDetail: typeof toHaveReceivedEventDetail;
19
19
  toHaveReceivedEventTimes: typeof toHaveReceivedEventTimes;
20
20
  toHaveFirstReceivedEventDetail: typeof toHaveFirstReceivedEventDetail;
21
+ toHaveLastReceivedEventDetail: typeof toHaveLastReceivedEventDetail;
21
22
  toHaveNthReceivedEventDetail: typeof toHaveNthReceivedEventDetail;
22
23
  toMatchScreenshot: typeof toMatchScreenshot;
23
24
  };
@@ -1,4 +1,4 @@
1
- import type { BuildCtx, CompilerCtx, LoadConfigInit, Module, UnvalidatedConfig, ValidatedConfig } from '@stencil/core/internal';
1
+ import type * as d from '@stencil/core/internal';
2
2
  import { TestingLogger } from './testing-logger';
3
3
  import { TestingSystem } from './testing-sys';
4
4
  /**
@@ -8,7 +8,7 @@ import { TestingSystem } from './testing-sys';
8
8
  * provided by this function.
9
9
  * @returns the mock Stencil configuration
10
10
  */
11
- export declare function mockValidatedConfig(overrides?: Partial<ValidatedConfig>): ValidatedConfig;
11
+ export declare function mockValidatedConfig(overrides?: Partial<d.ValidatedConfig>): d.ValidatedConfig;
12
12
  /**
13
13
  * Creates a mock instance of a Stencil configuration entity. The mocked configuration has no guarantees around the
14
14
  * types/validity of its data.
@@ -16,7 +16,7 @@ export declare function mockValidatedConfig(overrides?: Partial<ValidatedConfig>
16
16
  * provided by this function.
17
17
  * @returns the mock Stencil configuration
18
18
  */
19
- export declare function mockConfig(overrides?: Partial<UnvalidatedConfig>): UnvalidatedConfig;
19
+ export declare function mockConfig(overrides?: Partial<d.UnvalidatedConfig>): d.UnvalidatedConfig;
20
20
  /**
21
21
  * Creates a configuration object used to bootstrap a Stencil task invocation
22
22
  *
@@ -27,16 +27,16 @@ export declare function mockConfig(overrides?: Partial<UnvalidatedConfig>): Unva
27
27
  * @param overrides the properties on the default entity to manually override
28
28
  * @returns the default configuration initialization object, with any overrides applied
29
29
  */
30
- export declare const mockLoadConfigInit: (overrides?: Partial<LoadConfigInit>) => LoadConfigInit;
31
- export declare function mockCompilerCtx(config?: ValidatedConfig): CompilerCtx;
32
- export declare function mockBuildCtx(config?: ValidatedConfig, compilerCtx?: CompilerCtx): BuildCtx;
30
+ export declare const mockLoadConfigInit: (overrides?: Partial<d.LoadConfigInit>) => d.LoadConfigInit;
31
+ export declare function mockCompilerCtx(config?: d.ValidatedConfig): d.CompilerCtx;
32
+ export declare function mockBuildCtx(config?: d.ValidatedConfig, compilerCtx?: d.CompilerCtx): d.BuildCtx;
33
33
  export declare function mockLogger(): TestingLogger;
34
34
  /**
35
- * Create a {@link CompilerSystem} entity for testing the compiler.
35
+ * Create a {@link d.CompilerSystem} entity for testing the compiler.
36
36
  *
37
37
  * This function acts as a thin wrapper around a {@link TestingSystem} entity creation. It exists to provide a logical
38
38
  * place in the codebase where we might expect Stencil engineers to reach for when attempting to mock a
39
- * {@link CompilerSystem} base type. Should there prove to be usage of both this function and the one it wraps,
39
+ * {@link d.CompilerSystem} base type. Should there prove to be usage of both this function and the one it wraps,
40
40
  * reconsider if this wrapper is necessary.
41
41
  *
42
42
  * @returns a System instance for testing purposes.
@@ -52,4 +52,4 @@ export declare function mockWindow(html?: string): Window;
52
52
  * @param mod is an override module that you can supply to set particular values
53
53
  * @returns a module object ready to use in tests!
54
54
  */
55
- export declare const mockModule: (mod?: Partial<Module>) => Module;
55
+ export declare const mockModule: (mod?: Partial<d.Module>) => d.Module;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/testing",
3
- "version": "4.18.3",
3
+ "version": "4.19.0",
4
4
  "description": "Stencil testing suite.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,8 +12,19 @@ export type PageCloseOptions = {
12
12
  export interface NewE2EPageOptions extends WaitForOptions {
13
13
  url?: string;
14
14
  html?: string;
15
+ /**
16
+ * If set to `true`, Stencil will throw an error if a console error occurs
17
+ */
15
18
  failOnConsoleError?: boolean;
19
+ /**
20
+ * If set to `true`, Stencil will throw an error if a network request fails
21
+ */
16
22
  failOnNetworkError?: boolean;
23
+ /**
24
+ * If set to `true`, Stencil will log failing network requests
25
+ * @default true
26
+ */
27
+ logFailingNetworkRequests?: boolean;
17
28
  }
18
29
  type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
19
30
  type PuppeteerPage = Omit<Page, 'bringToFront' | 'browser' | 'screenshot' | 'emulate' | 'emulateMedia' | 'frames' | 'goBack' | 'goForward' | 'isClosed' | 'mainFrame' | 'pdf' | 'reload' | 'target' | 'title' | 'viewport' | 'waitForNavigation' | 'screenshot' | 'workers' | 'addListener' | 'prependListener' | 'prependOnceListener' | 'removeAllListeners' | 'setMaxListeners' | 'getMaxListeners' | 'listeners' | 'rawListeners' | 'emit' | 'eventNames' | 'listenerCount' | '$x' | 'waitForXPath'>;