diff --git a/eslint.config.mjs b/eslint.config.mjs index b47c158219..36290fe0ab 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -361,7 +361,6 @@ export default tseslint.config( globals: { lwcRuntimeFlags: true, process: true, - TestUtils: true, ...globals.browser, ...globals.jasmine, }, diff --git a/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js b/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js index 74f66ee942..0e63ceed00 100644 --- a/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js +++ b/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js @@ -50,7 +50,7 @@ async function compileModule(input, targetSSR, format) { }), ], - external: ['lwc', '@lwc/ssr-runtime', 'test-utils', '@test/loader'], // @todo: add ssr modules for test-utils and @test/loader + external: ['lwc', '@lwc/ssr-runtime'], onwarn(warning, warn) { // Ignore warnings from our own Rollup plugin diff --git a/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js b/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js index fdac34287f..e3c14e6db5 100644 --- a/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js +++ b/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js @@ -84,12 +84,9 @@ const transform = async (ctx) => { cache, plugins: [customLwcRollupPlugin], - // Rollup should not attempt to resolve the engine and the test utils, Karma takes care of injecting it - // globally in the page before running the tests. external: [ 'lwc', 'wire-service', - '@test/loader', // Some helper files export functions that mutate a global state. The setup file calls // some of those functions and does not get bundled. Including the helper files in the // bundle would create a separate global state, causing tests to fail. We don't need to diff --git a/packages/@lwc/integration-not-karma/helpers/reporting-control.js b/packages/@lwc/integration-not-karma/helpers/reporting-control.js new file mode 100644 index 0000000000..390b2b6679 --- /dev/null +++ b/packages/@lwc/integration-not-karma/helpers/reporting-control.js @@ -0,0 +1,18 @@ +import { __unstable__ReportingControl } from 'lwc'; + +/** + * + * @param dispatcher + * @param runtimeEvents List of runtime events to filter by. If no list is provided, all events will be dispatched. + */ +export function attachReportingControlDispatcher(dispatcher, runtimeEvents) { + __unstable__ReportingControl.attachDispatcher((eventName, payload) => { + if (!runtimeEvents || runtimeEvents.includes(eventName)) { + dispatcher(eventName, payload); + } + }); +} + +export function detachReportingControlDispatcher() { + __unstable__ReportingControl.detachDispatcher(); +} diff --git a/packages/@lwc/integration-not-karma/helpers/setup.js b/packages/@lwc/integration-not-karma/helpers/setup.js index 07f7f27d89..9a71cb08c0 100644 --- a/packages/@lwc/integration-not-karma/helpers/setup.js +++ b/packages/@lwc/integration-not-karma/helpers/setup.js @@ -3,15 +3,10 @@ import { JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expe import * as chai from 'chai'; import { spyOn, fn } from '@vitest/spy'; import { registerCustomMatchers } from './matchers/index.js'; -import * as TestUtils from './utils.js'; import { initSignals } from './signals.js'; initSignals(); -// FIXME: As a relic of the Karma tests, some test files rely on the global object, -// rather than importing from `test-utils`. -window.TestUtils = TestUtils; - // allows using expect.extend instead of chai.use to extend plugins chai.use(JestExtend); // adds all jest matchers to expect diff --git a/packages/@lwc/integration-not-karma/helpers/utils.js b/packages/@lwc/integration-not-karma/helpers/utils.js index 21abab22ca..ef6fde2c77 100644 --- a/packages/@lwc/integration-not-karma/helpers/utils.js +++ b/packages/@lwc/integration-not-karma/helpers/utils.js @@ -1,7 +1,6 @@ /* * An as yet uncategorized mishmash of helpers, relics of Karma */ -import { __unstable__ReportingControl } from 'lwc'; // Listen for errors thrown directly by the callback function directErrorListener(callback) { @@ -47,23 +46,6 @@ export function customElementCallbackReactionErrorListener(callback) { : windowErrorListener(callback); } -/** - * - * @param dispatcher - * @param runtimeEvents List of runtime events to filter by. If no list is provided, all events will be dispatched. - */ -export function attachReportingControlDispatcher(dispatcher, runtimeEvents) { - __unstable__ReportingControl.attachDispatcher((eventName, payload) => { - if (!runtimeEvents || runtimeEvents.includes(eventName)) { - dispatcher(eventName, payload); - } - }); -} - -export function detachReportingControlDispatcher() { - __unstable__ReportingControl.detachDispatcher(); -} - export function extractDataIds(root) { const nodes = {}; diff --git a/packages/@lwc/integration-not-karma/test-hydration/attributes/falsy-mismatch/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/attributes/falsy-mismatch/index.spec.js index fc730181aa..7fe011220f 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/attributes/falsy-mismatch/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/attributes/falsy-mismatch/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../helpers/utils.js'; + export default { props: { isFalse: false, @@ -28,7 +30,7 @@ export default { expect(divs[i].getAttribute('data-foo')).toEqual(expectedAttrValues[i]); } - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: title="ssr-title" - expected on client: title="client-title"', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/attrs-expression/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/attrs-expression/index.spec.js index 00585b1f87..d1de3fb3a4 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/attrs-expression/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/attrs-expression/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../helpers/utils.js'; + export default { props: { foo: 'server', @@ -17,7 +19,7 @@ export default { expect(div.getAttribute('data-foo')).toBe('client'); expect(div.getAttribute('data-static')).toBe('same-value'); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="c1 c2 c3" - expected on client: class="c2 c3 c4"', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-empty-in-ssr-null-string-in-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-empty-in-ssr-null-string-in-client/index.spec.js index d9662f2dd1..d314088097 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-empty-in-ssr-null-string-in-client/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-empty-in-ssr-null-string-in-client/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + // SSR has no class at all, whereas the client has `class="null"`. // This is to test if hydration is smart enough to recognize the difference between a null // attribute and the literal string "null". @@ -21,7 +23,7 @@ export default { expect(p).not.toBe(snapshots.p); expect(p.className).not.toBe(snapshots.className); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="" - expected on client: class="null"', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-null-string-in-ssr-empty-in-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-null-string-in-ssr-empty-in-client/index.spec.js index ba5521c8b8..65b3eb3256 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-null-string-in-ssr-empty-in-client/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-null-string-in-ssr-empty-in-client/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + // SSR has `class="null"`, whereas the client has no class at all. // This is to test if hydration is smart enough to recognize the difference between a null // attribute and the literal string "null". @@ -21,7 +23,7 @@ export default { expect(p).not.toBe(snapshots.p); expect(p.className).not.toBe(snapshots.className); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="null" - expected on client: class=""', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-same-different-order-does-not-throw/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-same-different-order-does-not-throw/index.spec.js index d60cecb71e..56d60f9fc7 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-same-different-order-does-not-throw/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/dynamic-same-different-order-does-not-throw/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { classes: 'c1 c2 c3', @@ -18,7 +20,7 @@ export default { expect(p).toBe(snapshots.p); expect(p.className).toBe(snapshots.classes); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [], }); diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-client-nonempty-on-server/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-client-nonempty-on-server/index.spec.js index 06fa19d842..238a20847b 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-client-nonempty-on-server/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-client-nonempty-on-server/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { classes: 'yolo', @@ -17,7 +19,7 @@ export default { expect(p).not.toBe(snapshots.p); expect(p.className).toBe(''); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="yolo" - expected on client: class=""', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-server-nonempty-on-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-server-nonempty-on-client/index.spec.js index cf15d194a8..ca71555d77 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-server-nonempty-on-client/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string-on-server-nonempty-on-client/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { classes: '', @@ -17,7 +19,7 @@ export default { expect(p).not.toBe(snapshots.p); expect(p.className).toBe('yolo'); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="" - expected on client: class="yolo"', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string/index.spec.js index 6766da610d..b986510723 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/empty-string/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { classes: '', @@ -14,7 +16,7 @@ export default { expect(p).toBe(snapshots.p); expect(p.className).toBe(snapshots.classes); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [], }); diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-client/index.spec.js index c212253276..300c373aae 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-client/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-client/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { ssr: true, @@ -19,7 +21,7 @@ export default { expect(p.className).not.toBe(snapshots.classes); expect(p.className).toBe('c1 c2 c3'); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="c1 c3" - expected on client: class="c1 c2 c3"', diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-server/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-server/index.spec.js index 8a4869acb9..7bec4446a3 100644 --- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-server/index.spec.js +++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/extra-class-from-server/index.spec.js @@ -1,3 +1,5 @@ +import { expectConsoleCallsDev } from '../../../../helpers/utils.js'; + export default { props: { ssr: true, @@ -19,7 +21,7 @@ export default { expect(p.className).not.toBe(snapshots.classes); expect(p.className).toBe('c1 c3'); - TestUtils.expectConsoleCallsDev(consoleCalls, { + expectConsoleCallsDev(consoleCalls, { error: [], warn: [ 'Hydration attribute mismatch on:
- rendered on server: class="c1 c2 c3" - expected on client: class="c1 c3"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/only-present-in-ssr/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/only-present-in-ssr/index.spec.js
index 6915109a14..366280e61f 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/only-present-in-ssr/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/class-attr/only-present-in-ssr/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../helpers/utils.js';
+
export default {
advancedTest(target, { Component, hydrateComponent, consoleSpy }) {
// This simulates a condition where the server-rendered markup has
@@ -11,7 +13,7 @@ export default {
hydrateComponent(target, Component, {});
const consoleCalls = consoleSpy.calls;
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: class="c3 c2 c1" - expected on client: class="c1 c2 c3"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/comment-instead-of-text/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/comment-instead-of-text/index.spec.js
index dfc078cd9f..2c2b60f320 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/comment-instead-of-text/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/comment-instead-of-text/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../helpers/utils.js';
+
export default {
props: {
showAsText: true,
@@ -17,7 +19,7 @@ export default {
expect(comment.nodeType).toBe(Node.COMMENT_NODE);
expect(comment.nodeValue).toBe(snapshots.text.nodeValue);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration node mismatch on: #comment - rendered on server: #text - expected on client: #comment',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/different-lwc-inner-html/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/different-lwc-inner-html/index.spec.js
index 461ce34b5a..ef8ecc792e 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/different-lwc-inner-html/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/different-lwc-inner-html/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../helpers/utils.js';
+
export default {
props: {
content: ' test-content test-content different-content - rendered on server: data-attrs="ssr-attrs" - expected on client: data-attrs="client-attrs"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/dynamic-component/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/dynamic-component/index.spec.js
index 658111cb33..74ddba5889 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/dynamic-component/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/dynamic-component/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../helpers/utils.js';
+
export default {
props: {
ctor: 'server',
@@ -17,7 +19,7 @@ export default {
// Client side constructor
expect(target.shadowRoot.querySelector('x-client')).not.toBeNull();
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration node mismatch on: - rendered on server: hello! - expected on client: bye!',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/host-mutation-in-connected-callback/attr-mutated-class-mismatch/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/host-mutation-in-connected-callback/attr-mutated-class-mismatch/index.spec.js
index 63d8c26a72..1ecc068a05 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/host-mutation-in-connected-callback/attr-mutated-class-mismatch/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/host-mutation-in-connected-callback/attr-mutated-class-mismatch/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../helpers/utils.js';
+
export default {
props: {
ssr: true,
@@ -24,7 +26,7 @@ export default {
expect(child.getAttribute('data-mutatis')).toBe('mutandis');
expect(child.getAttribute('class')).toBe('is-client');
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red;" - expected on client: style="background-color: red; border-color: red !important;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js
index 5d843688be..8520604f94 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
dynamicStyle: 'background-color: red; border-color: red;',
@@ -21,7 +23,7 @@ export default {
'background-color: red; border-color: red; margin: 1px;'
);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red;" - expected on client: style="background-color: red; border-color: red; margin: 1px;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js
index ca92f666fe..bdf60b7c45 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
dynamicStyle: 'background-color: red; border-color: red; margin: 1px;',
@@ -19,7 +21,7 @@ export default {
expect(p.getAttribute('style')).not.toBe(snapshots.style);
expect(p.getAttribute('style')).toBe('background-color: red; border-color: red;');
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red; margin: 1px;" - expected on client: style="background-color: red; border-color: red;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js
index a9f3d09d8a..40786d91c2 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
dynamicStyle: 'background-color: red; border-color: red; margin: 1px;',
@@ -20,7 +22,7 @@ export default {
'margin: 1px; border-color: red; background-color: red;'
);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red; margin: 1px;" - expected on client: style="margin: 1px; border-color: red; background-color: red;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-client-nonempty-on-server/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-client-nonempty-on-server/index.spec.js
index 6648a2a90a..6ccc8fb235 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-client-nonempty-on-server/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-client-nonempty-on-server/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
styles: 'color: burlywood;',
@@ -17,7 +19,7 @@ export default {
expect(p).not.toBe(snapshots.p);
expect(p.getAttribute('style')).toBe(null);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="color: burlywood;" - expected on client: style=""',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-server-nonempty-on-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-server-nonempty-on-client/index.spec.js
index aca494470d..745cffe63d 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-server-nonempty-on-client/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/empty-string/empty-on-server-nonempty-on-client/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
styles: '',
@@ -17,7 +19,7 @@ export default {
expect(p).not.toBe(snapshots.p);
expect(p.getAttribute('style')).toBe('color: burlywood;');
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="" - expected on client: style="color: burlywood;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js
index 80b6824fc4..8566cc6778 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
ssr: true,
@@ -21,7 +23,7 @@ export default {
'background-color: red; border-color: red !important;'
);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red;" - expected on client: style="background-color: red; border-color: red !important;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js
index 89f82ca68a..fb56c341e9 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
ssr: true,
@@ -21,7 +23,7 @@ export default {
'background-color: red; border-color: red; margin: 1px;'
);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red;" - expected on client: style="background-color: red; border-color: red; margin: 1px;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js
index f8bf2b3f88..6d4cb3bedf 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
ssr: true,
@@ -19,7 +21,7 @@ export default {
expect(p.getAttribute('style')).not.toBe(snapshots.style);
expect(p.getAttribute('style')).toBe('background-color: red; border-color: red;');
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red; margin: 1px;" - expected on client: style="background-color: red; border-color: red;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js
index 6c8fa727f2..4f60a1854d 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
props: {
ssr: true,
@@ -27,7 +29,7 @@ export default {
'margin: 1px; border-color: red; background-color: red;'
);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server: style="background-color: red; border-color: red; margin: 1px;" - expected on client: style="margin: 1px; border-color: red; background-color: red;"',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/text-instead-of-comment/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/text-instead-of-comment/index.spec.js
index ff771b9486..5067cbd985 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/text-instead-of-comment/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/text-instead-of-comment/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../helpers/utils.js';
+
export default {
props: {
showAsText: false,
@@ -17,7 +19,7 @@ export default {
expect(text.nodeType).toBe(Node.TEXT_NODE);
expect(text.nodeValue).toBe(snapshots.comment.nodeValue);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration node mismatch on: #text - rendered on server: #comment - expected on client: #text',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/textNode-instead-of-element/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/textNode-instead-of-element/index.spec.js
index 677f8106d9..0fa8c76759 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/textNode-instead-of-element/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/textNode-instead-of-element/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../helpers/utils.js';
+
export default {
props: {
showAsText: true,
@@ -19,7 +21,7 @@ export default {
expect(text.nodeType).toBe(Node.ELEMENT_NODE);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration node mismatch on: - rendered on server: #text - expected on client: ',
diff --git a/packages/@lwc/integration-not-karma/test-hydration/mismatches/with-validation-opt-out/mutate-in-connected-and-render/no-opt-out/index.spec.js b/packages/@lwc/integration-not-karma/test-hydration/mismatches/with-validation-opt-out/mutate-in-connected-and-render/no-opt-out/index.spec.js
index c7de6e2d5f..26b5a4cfaf 100644
--- a/packages/@lwc/integration-not-karma/test-hydration/mismatches/with-validation-opt-out/mutate-in-connected-and-render/no-opt-out/index.spec.js
+++ b/packages/@lwc/integration-not-karma/test-hydration/mismatches/with-validation-opt-out/mutate-in-connected-and-render/no-opt-out/index.spec.js
@@ -1,3 +1,5 @@
+import { expectConsoleCallsDev } from '../../../../../helpers/utils.js';
+
export default {
snapshot(target) {
return {
@@ -8,7 +10,7 @@ export default {
const hydratedSnapshot = this.snapshot(target);
expect(hydratedSnapshot.child).not.toBe(snapshots.child);
- TestUtils.expectConsoleCallsDev(consoleCalls, {
+ expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: - rendered on server:
- rendered on server: