diff --git a/eslint.config.mjs b/eslint.config.mjs index f890cfb35a..b47c158219 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -355,7 +355,25 @@ export default tseslint.config( }, }, { - files: ['packages/@lwc/integration-karma/**', 'packages/@lwc/integration-not-karma/**'], + files: ['packages/@lwc/integration-not-karma/**'], + + languageOptions: { + globals: { + lwcRuntimeFlags: true, + process: true, + TestUtils: true, + ...globals.browser, + ...globals.jasmine, + }, + }, + + rules: { + 'no-var': 'off', + 'prefer-rest-params': 'off', + }, + }, + { + files: ['packages/@lwc/integration-karma/**'], languageOptions: { globals: { 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 1e495f3033..0ae204ef46 100644 --- a/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js +++ b/packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js @@ -1,6 +1,7 @@ import path from 'node:path'; import vm from 'node:vm'; import fs from 'node:fs/promises'; +import { fileURLToPath } from 'node:url'; import { rollup } from 'rollup'; import lwcRollupPlugin from '@lwc/rollup-plugin'; import { DISABLE_STATIC_CONTENT_OPTIMIZATION, ENGINE_SERVER } from '../../helpers/options.js'; @@ -39,7 +40,7 @@ async function getCompiledModule(dir, compileForSSR) { targetSSR: !!compileForSSR, modules: [{ dir: path.join(ROOT_DIR, dir) }], experimentalDynamicComponent: { - loader: 'test-utils', + loader: fileURLToPath(new URL('../../helpers/loader.js', import.meta.url)), strict: true, }, enableDynamicComponents: true, @@ -198,6 +199,7 @@ async function wrapHydrationTest(filePath) { // FIXME: can we turn these IIFEs into ESM imports? return ` + import * as LWC from 'lwc'; import { runTest } from '/helpers/test-hydrate.js'; import config from '/${filePath}?original=1'; ${onlyFileExists ? 'it.only' : 'it'}('${filePath}', async () => { 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 d3a5bb6044..fdac34287f 100644 --- a/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js +++ b/packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js @@ -10,8 +10,6 @@ import { DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER, } from '../../helpers/options.js'; -const UTILS = fileURLToPath(new URL('../../helpers/utils.js', import.meta.url)); - /** Cache reused between each compilation to speed up the compilation time. */ let cache; @@ -25,7 +23,7 @@ const createRollupPlugin = (input, options) => { // Sourcemaps don't work with Istanbul coverage sourcemap: !process.env.COVERAGE, experimentalDynamicComponent: { - loader: UTILS, + loader: fileURLToPath(new URL('../../helpers/dynamic-loader', import.meta.url)), strict: true, }, enableDynamicComponents: true, @@ -88,7 +86,16 @@ const transform = async (ctx) => { // 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', UTILS], + 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 + // mark _all_ helpers as external, but we do anyway for ease of maintenance. + /\/helpers\/\w+\.js$/, + ], onwarn(warning, warn) { // Ignore warnings from our own Rollup plugin diff --git a/packages/@lwc/integration-not-karma/helpers/constants.js b/packages/@lwc/integration-not-karma/helpers/constants.js index 25c89c3116..50454f2362 100644 --- a/packages/@lwc/integration-not-karma/helpers/constants.js +++ b/packages/@lwc/integration-not-karma/helpers/constants.js @@ -1,7 +1,7 @@ import { API_VERSION } from './options.js'; -// These values are based on the API versions in @lwc/shared/api-version -export const LOWERCASE_SCOPE_TOKENS = API_VERSION >= 59, +export const // These values are based on the API versions in @lwc/shared/api-version + LOWERCASE_SCOPE_TOKENS = API_VERSION >= 59, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS = API_VERSION >= 60, USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS = API_VERSION >= 60, DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION = API_VERSION >= 60, diff --git a/packages/@lwc/integration-not-karma/helpers/dynamic-loader.js b/packages/@lwc/integration-not-karma/helpers/dynamic-loader.js new file mode 100644 index 0000000000..b61af17f11 --- /dev/null +++ b/packages/@lwc/integration-not-karma/helpers/dynamic-loader.js @@ -0,0 +1,9 @@ +// Helpers for testing lwc:dynamic +const register = new Map(); +/** + * Called by compiled components to, well, load another component. The path to this file is + * specified by the `experimentalDynamicComponent.loader` rollup plugin option. + */ +export const load = async (id) => await Promise.resolve(register.get(id)); +export const registerForLoad = (name, Ctor) => register.set(name, Ctor); +export const clearRegister = () => register.clear(); diff --git a/packages/@lwc/integration-not-karma/helpers/options.js b/packages/@lwc/integration-not-karma/helpers/options.js index 477f534963..9a27788f62 100644 --- a/packages/@lwc/integration-not-karma/helpers/options.js +++ b/packages/@lwc/integration-not-karma/helpers/options.js @@ -40,8 +40,6 @@ export const API_VERSION = process.env.API_VERSION export const NODE_ENV_FOR_TEST = process.env.NODE_ENV_FOR_TEST || 'development'; -export const GREP = process.env.GREP; - export const NATIVE_SHADOW = DISABLE_SYNTHETIC || FORCE_NATIVE_SHADOW_MODE_FOR_TEST; /** Unique directory name that encodes the flags that the tests were executed with. */ diff --git a/packages/@lwc/integration-not-karma/helpers/setup.js b/packages/@lwc/integration-not-karma/helpers/setup.js index 7a64aff7cb..07f7f27d89 100644 --- a/packages/@lwc/integration-not-karma/helpers/setup.js +++ b/packages/@lwc/integration-not-karma/helpers/setup.js @@ -1,10 +1,12 @@ // This import ensures that the global `Mocha` object is present for mutation. import { JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expect'; import * as chai from 'chai'; -import * as LWC from 'lwc'; 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`. @@ -47,8 +49,6 @@ function jasmineSpyAdapter(spy) { // expose so we don't need to import `expect` in every test file globalThis.expect = chai.expect; -// Expose globals for karma compat -globalThis.LWC = LWC; globalThis.spyOn = (object, prop) => jasmineSpyAdapter(spyOn(object, prop)); globalThis.jasmine = { any: expect.any, diff --git a/packages/@lwc/integration-not-karma/helpers/signals.js b/packages/@lwc/integration-not-karma/helpers/signals.js index 40a45eada1..f3dd96ed28 100644 --- a/packages/@lwc/integration-not-karma/helpers/signals.js +++ b/packages/@lwc/integration-not-karma/helpers/signals.js @@ -1,7 +1,10 @@ import { setTrustedSignalSet } from 'lwc'; const signalValidator = new WeakSet(); -setTrustedSignalSet(signalValidator); + +export function initSignals() { + setTrustedSignalSet(signalValidator); +} export function addTrustedSignal(signal) { signalValidator.add(signal); diff --git a/packages/@lwc/integration-not-karma/helpers/utils.js b/packages/@lwc/integration-not-karma/helpers/utils.js index 3c31c07047..21abab22ca 100644 --- a/packages/@lwc/integration-not-karma/helpers/utils.js +++ b/packages/@lwc/integration-not-karma/helpers/utils.js @@ -1,29 +1,7 @@ /* * An as yet uncategorized mishmash of helpers, relics of Karma */ -import * as LWC from 'lwc'; -import { - ariaAttributes, - ariaProperties, - ariaPropertiesMapping, - nonPolyfilledAriaProperties, - nonStandardAriaProperties, -} from './aria.js'; -import { setHooks, getHooks } from './hooks.js'; -import { spyConsole } from './console.js'; -import { - DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION, - ENABLE_ELEMENT_INTERNALS_AND_FACE, - ENABLE_THIS_DOT_HOST_ELEMENT, - ENABLE_THIS_DOT_STYLE, - IS_SYNTHETIC_SHADOW_LOADED, - LOWERCASE_SCOPE_TOKENS, - TEMPLATE_CLASS_NAME_OBJECT_BINDING, - USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, - USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS, - USE_LIGHT_DOM_SLOT_FORWARDING, -} from './constants.js'; -import { addTrustedSignal } from './signals.js'; +import { __unstable__ReportingControl } from 'lwc'; // Listen for errors thrown directly by the callback function directErrorListener(callback) { @@ -63,7 +41,7 @@ function windowErrorListener(callback) { // 2) We're using native lifecycle callbacks, so the error is thrown asynchronously and can // only be caught with window.addEventListener('error') // - Note native lifecycle callbacks are all thrown asynchronously. -function customElementCallbackReactionErrorListener(callback) { +export function customElementCallbackReactionErrorListener(callback) { return lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE ? directErrorListener(callback) : windowErrorListener(callback); @@ -74,19 +52,19 @@ function customElementCallbackReactionErrorListener(callback) { * @param dispatcher * @param runtimeEvents List of runtime events to filter by. If no list is provided, all events will be dispatched. */ -function attachReportingControlDispatcher(dispatcher, runtimeEvents) { - LWC.__unstable__ReportingControl.attachDispatcher((eventName, payload) => { +export function attachReportingControlDispatcher(dispatcher, runtimeEvents) { + __unstable__ReportingControl.attachDispatcher((eventName, payload) => { if (!runtimeEvents || runtimeEvents.includes(eventName)) { dispatcher(eventName, payload); } }); } -function detachReportingControlDispatcher() { - LWC.__unstable__ReportingControl.detachDispatcher(); +export function detachReportingControlDispatcher() { + __unstable__ReportingControl.detachDispatcher(); } -function extractDataIds(root) { +export function extractDataIds(root) { const nodes = {}; function processElement(elm) { @@ -120,7 +98,7 @@ function extractDataIds(root) { return nodes; } -function extractShadowDataIds(shadowRoot) { +export function extractShadowDataIds(shadowRoot) { const nodes = {}; // Add the shadow root here even if they don't have [data-id] attributes. This reference is @@ -140,36 +118,24 @@ function extractShadowDataIds(shadowRoot) { return nodes; } -let register = {}; -function load(id) { - return Promise.resolve(register[id]); -} - -function registerForLoad(name, Ctor) { - register[name] = Ctor; -} -function clearRegister() { - register = {}; -} - // #986 - childNodes on the host element returns a fake shadow comment node on IE11 for debugging purposes. This method // filters this node. -function getHostChildNodes(host) { +export function getHostChildNodes(host) { return Array.prototype.slice.call(host.childNodes).filter(function (n) { return !(n.nodeType === Node.COMMENT_NODE && n.tagName.startsWith('#shadow-root')); }); } -function isSyntheticShadowRootInstance(sr) { +export function isSyntheticShadowRootInstance(sr) { return Boolean(sr && sr.synthetic); } -function isNativeShadowRootInstance(sr) { +export function isNativeShadowRootInstance(sr) { return Boolean(sr && !sr.synthetic); } // Keep traversing up the prototype chain until a property descriptor is found -function getPropertyDescriptor(object, prop) { +export function getPropertyDescriptor(object, prop) { do { const descriptor = Object.getOwnPropertyDescriptor(object, prop); if (descriptor) { @@ -216,13 +182,13 @@ function stringifyArg(arg) { } } -const expectConsoleCalls = createExpectConsoleCallsFunc(false); -const expectConsoleCallsDev = createExpectConsoleCallsFunc(true); +export const expectConsoleCalls = createExpectConsoleCallsFunc(false); +export const expectConsoleCallsDev = createExpectConsoleCallsFunc(true); // Utility to handle unhandled rejections or errors without allowing Jasmine to handle them first. // Captures both onunhandledrejection and onerror events, since you might want both depending on // native vs synthetic lifecycle timing differences. -function catchUnhandledRejectionsAndErrors(onUnhandledRejectionOrError) { +export function catchUnhandledRejectionsAndErrors(onUnhandledRejectionOrError) { let originalOnError; const onError = (e) => { @@ -257,7 +223,7 @@ function catchUnhandledRejectionsAndErrors(onUnhandledRejectionOrError) { // Succeeds if the given DOM element is equivalent to the given HTML in terms of nodes and elements. This is // basically the same as `expect(element.outerHTML).toBe(html)` except that it works despite bugs in synthetic shadow. -function expectEquivalentDOM(element, html) { +export function expectEquivalentDOM(element, html) { const fragment = Document.parseHTMLUnsafe(html); // When the fragment is parsed, the string "abc" is considered one text node. Whereas the engine @@ -314,41 +280,3 @@ function expectEquivalentDOM(element, html) { expectEquivalent(element, fragment.body.firstChild); } - -export { - clearRegister, - extractDataIds, - extractShadowDataIds, - getHostChildNodes, - isNativeShadowRootInstance, - isSyntheticShadowRootInstance, - load, - registerForLoad, - getHooks, - setHooks, - spyConsole, - customElementCallbackReactionErrorListener, - ariaPropertiesMapping, - ariaProperties, - ariaAttributes, - nonStandardAriaProperties, - nonPolyfilledAriaProperties, - getPropertyDescriptor, - attachReportingControlDispatcher, - detachReportingControlDispatcher, - IS_SYNTHETIC_SHADOW_LOADED, - expectConsoleCalls, - expectConsoleCallsDev, - catchUnhandledRejectionsAndErrors, - addTrustedSignal, - expectEquivalentDOM, - LOWERCASE_SCOPE_TOKENS, - USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, - USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS, - DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION, - ENABLE_ELEMENT_INTERNALS_AND_FACE, - USE_LIGHT_DOM_SLOT_FORWARDING, - ENABLE_THIS_DOT_HOST_ELEMENT, - ENABLE_THIS_DOT_STYLE, - TEMPLATE_CLASS_NAME_OBJECT_BINDING, -}; diff --git a/packages/@lwc/integration-not-karma/test/accessibility/non-standard-aria-props/index.spec.js b/packages/@lwc/integration-not-karma/test/accessibility/non-standard-aria-props/index.spec.js index e47812f130..78a91b36b0 100644 --- a/packages/@lwc/integration-not-karma/test/accessibility/non-standard-aria-props/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/accessibility/non-standard-aria-props/index.spec.js @@ -1,10 +1,10 @@ import { createElement } from 'lwc'; import Light from 'x/light'; import Shadow from 'x/shadow'; +import { nonStandardAriaProperties } from '../../../helpers/aria.js'; import { attachReportingControlDispatcher, detachReportingControlDispatcher, - nonStandardAriaProperties, } from '../../../helpers/utils.js'; // This test only works if the ARIA reflection polyfill is loaded diff --git a/packages/@lwc/integration-not-karma/test/api/CustomElementConstructor-getter/index.spec.js b/packages/@lwc/integration-not-karma/test/api/CustomElementConstructor-getter/index.spec.js index 88e77d02f2..5d224c512c 100644 --- a/packages/@lwc/integration-not-karma/test/api/CustomElementConstructor-getter/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/api/CustomElementConstructor-getter/index.spec.js @@ -9,8 +9,8 @@ import AttrChanged from 'x/attrChanged'; import ReflectCamel from 'x/reflectCamel'; import WithChildElmsHasSlot from 'x/withChildElmsHasSlot'; import WithChildElmsHasSlotLight from 'x/withChildElmsHasSlotLight'; -import { spyConsole } from '../../../helpers/utils.js'; -import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; +import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../helpers/constants.js'; const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '' : ''; diff --git a/packages/@lwc/integration-not-karma/test/api/getComponentDef/index.spec.js b/packages/@lwc/integration-not-karma/test/api/getComponentDef/index.spec.js index 069f81f106..918284e89f 100644 --- a/packages/@lwc/integration-not-karma/test/api/getComponentDef/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/api/getComponentDef/index.spec.js @@ -7,7 +7,7 @@ import PublicPropertiesInheritance from 'x/publicPropertiesInheritance'; import PublicMethodsInheritance from 'x/publicMethodsInheritance'; import PrivateAccessors from 'x/privateAccessors'; import HtmlElementProps from 'x/htmlElementProps'; -import { ariaProperties } from '../../../helpers/utils.js'; +import { ariaProperties } from '../../../helpers/aria.js'; function testInvalidComponentConstructor(name, ctor) { it(`should throw for ${name}`, () => { diff --git a/packages/@lwc/integration-not-karma/test/api/sanitizeAttribute/index.spec.js b/packages/@lwc/integration-not-karma/test/api/sanitizeAttribute/index.spec.js index 6d1d43f76a..7062413c7f 100644 --- a/packages/@lwc/integration-not-karma/test/api/sanitizeAttribute/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/api/sanitizeAttribute/index.spec.js @@ -1,4 +1,8 @@ -import { createElement } from 'lwc'; +import { + createElement, + // Spy is created in a mock file and injected with the import map plugin + sanitizeAttribute as sanitizeAttributeSpy, +} from 'lwc'; import XlinkStatic from 'x/xlinkStatic'; import XlinkDynamic from 'x/xlinkDynamic'; @@ -36,8 +40,6 @@ const scenarios = [ scenarios.forEach(({ type, attrName, tagName, Ctor }) => { describe(`${type} ${attrName}`, () => { - // Spy is created in a mock file and injected with the import map plugin - const sanitizeAttributeSpy = LWC.sanitizeAttribute; afterEach(() => { sanitizeAttributeSpy.mockReset(); }); @@ -54,7 +56,7 @@ scenarios.forEach(({ type, attrName, tagName, Ctor }) => { const elm = createElement(tagName, { is: Ctor }); document.body.appendChild(elm); - expect(LWC.sanitizeAttribute).toHaveBeenCalledWith( + expect(sanitizeAttributeSpy).toHaveBeenCalledWith( 'use', 'http://www.w3.org/2000/svg', attrName, @@ -108,7 +110,7 @@ booleanTrueScenarios.forEach(({ attrName, tagName, Ctor }) => { const use = elm.shadowRoot.querySelector('use'); expect(use.getAttribute(attrName)).toBe(''); - expect(LWC.sanitizeAttribute).not.toHaveBeenCalled(); + expect(sanitizeAttributeSpy).not.toHaveBeenCalled(); }); }); }); diff --git a/packages/@lwc/integration-not-karma/test/api/sanitizeHtmlContent/index.spec.js b/packages/@lwc/integration-not-karma/test/api/sanitizeHtmlContent/index.spec.js index 2d8ab02a12..e8d5c3dccd 100644 --- a/packages/@lwc/integration-not-karma/test/api/sanitizeHtmlContent/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/api/sanitizeHtmlContent/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import XInnerHtml from 'x/innerHtml'; -import { getHooks, setHooks } from '../../../helpers/utils.js'; +import { getHooks, setHooks } from '../../../helpers/hooks.js'; const ACTUAL_CONTENT = 'Hello World'; const ALTERNATIVE_CONTENT = 'Hello LWC'; diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.addEventListener/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.addEventListener/index.spec.js index 033a86f084..2b10f0152f 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.addEventListener/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.addEventListener/index.spec.js @@ -3,7 +3,7 @@ import { createElement } from 'lwc'; import EventHandler from 'x/eventHandler'; import EventHandlerOptions from 'x/eventHandlerOptions'; import AdditionWhileDispatch from 'x/additionWhileDispatch'; -import { spyConsole } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; it('should be able to attach an event listener on the host element', () => { let thisValue; diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/api/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/api/index.spec.js index 7382a011ac..22c813fd13 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/api/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/api/index.spec.js @@ -4,10 +4,10 @@ import ShadowDomCmp from 'ai/shadowDom'; import LightDomCmp from 'ai/lightDom'; import BasicCmp from 'ai/basic'; import { - customElementCallbackReactionErrorListener, ENABLE_ELEMENT_INTERNALS_AND_FACE, IS_SYNTHETIC_SHADOW_LOADED, -} from '../../../../helpers/utils.js'; +} from '../../../../helpers/constants.js'; +import { customElementCallbackReactionErrorListener } from '../../../../helpers/utils.js'; const testConnectedCallbackError = (elm, msg) => { const error = customElementCallbackReactionErrorListener(() => { diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js index 059b780dea..1d68671a7e 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js @@ -9,7 +9,7 @@ import FormAssociatedFalseNoAttachInternals from 'x/formAssociatedFalseNoAttachI import { ENABLE_ELEMENT_INTERNALS_AND_FACE, IS_SYNTHETIC_SHADOW_LOADED, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; describe.runIf( ENABLE_ELEMENT_INTERNALS_AND_FACE && diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/ei/component/component.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/ei/component/component.js index 50243d3cdb..f6509f7110 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/ei/component/component.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/ei/component/component.js @@ -1,5 +1,5 @@ import { LightningElement, api } from 'lwc'; -import { ariaProperties } from '../../../../../../../helpers/utils.js'; +import { ariaProperties } from '../../../../../../../helpers/aria.js'; export default class extends LightningElement { @api diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/index.spec.js index fd3b3ddb8a..8bf34045ab 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/index.spec.js @@ -1,10 +1,7 @@ import { createElement } from 'lwc'; import ElementInternal from 'ei/component'; -import { - ariaProperties, - ariaAttributes, - ENABLE_ELEMENT_INTERNALS_AND_FACE, -} from '../../../../../helpers/utils.js'; +import { ariaProperties, ariaAttributes } from '../../../../../helpers/aria.js'; +import { ENABLE_ELEMENT_INTERNALS_AND_FACE } from '../../../../../helpers/constants.js'; let elm; beforeEach(() => { diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.hostElement/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.hostElement/index.spec.js index a504f48f73..97567c6e84 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.hostElement/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.hostElement/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Wrapper from 'x/wrapper'; -import { ENABLE_THIS_DOT_HOST_ELEMENT } from '../../../helpers/utils.js'; +import { ENABLE_THIS_DOT_HOST_ELEMENT } from '../../../helpers/constants.js'; function createWrapper() { const elm = createElement('x-wrapper', { is: Wrapper }); diff --git a/packages/@lwc/integration-not-karma/test/component/LightningElement.style/index.spec.js b/packages/@lwc/integration-not-karma/test/component/LightningElement.style/index.spec.js index 5c59661634..f3206feefe 100644 --- a/packages/@lwc/integration-not-karma/test/component/LightningElement.style/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/LightningElement.style/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Test from 'x/test'; -import { ENABLE_THIS_DOT_STYLE } from '../../../helpers/utils.js'; +import { ENABLE_THIS_DOT_STYLE } from '../../../helpers/constants.js'; it.runIf(ENABLE_THIS_DOT_STYLE)( 'this.style should return the CSSStyleDeclaration of host element', diff --git a/packages/@lwc/integration-not-karma/test/component/aria-reflection/index.spec.js b/packages/@lwc/integration-not-karma/test/component/aria-reflection/index.spec.js index 8e1b5dceca..15467e1300 100644 --- a/packages/@lwc/integration-not-karma/test/component/aria-reflection/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/aria-reflection/index.spec.js @@ -7,7 +7,8 @@ import NoPropDeclaredNoSuper from 'x/noPropDeclaredNoSuper'; import PropDeclaredNoSuper from 'x/propDeclaredNoSuper'; import ApiPropDeclaredNoSuper from 'x/apiPropDeclaredNoSuper'; import TrackPropDeclaredNoSuper from 'x/trackPropDeclaredNoSuper'; -import { ariaPropertiesMapping, extractDataIds } from '../../../helpers/utils.js'; +import { ariaPropertiesMapping } from '../../../helpers/aria.js'; +import { extractDataIds } from '../../../helpers/utils.js'; describe('aria reflection', () => { // Test with and without a custom superclass, since we may set the property accessor differently in each case diff --git a/packages/@lwc/integration-not-karma/test/component/dynamic-imports/index.spec.js b/packages/@lwc/integration-not-karma/test/component/dynamic-imports/index.spec.js index 891bf7e098..8176b9b48c 100644 --- a/packages/@lwc/integration-not-karma/test/component/dynamic-imports/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/dynamic-imports/index.spec.js @@ -10,7 +10,8 @@ import LwcDynamicSlotted from 'x/lwcDynamicSlotted'; import ContainerFoo from 'x/containerFoo'; import ContainerBar from 'x/containerBar'; -import { registerForLoad, clearRegister, spyConsole } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; +import { registerForLoad, clearRegister } from '../../../helpers/dynamic-loader.js'; beforeEach(() => { clearRegister(); diff --git a/packages/@lwc/integration-not-karma/test/component/face-callbacks/index.spec.js b/packages/@lwc/integration-not-karma/test/component/face-callbacks/index.spec.js index 2460c870a1..d7890187e5 100644 --- a/packages/@lwc/integration-not-karma/test/component/face-callbacks/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/face-callbacks/index.spec.js @@ -5,7 +5,7 @@ import FormAssociated from 'x/formAssociated'; import NotFormAssociated from 'x/notFormAssociated'; import LightDomFormAssociated from 'x/lightDomFormAssociated'; import LightDomNotFormAssociated from 'x/lightDomNotFormAssociated'; -import { ENABLE_ELEMENT_INTERNALS_AND_FACE } from '../../../helpers/utils.js'; +import { ENABLE_ELEMENT_INTERNALS_AND_FACE } from '../../../helpers/constants.js'; const createFormElement = () => { const container = createElement('face-container', { is: Container }); diff --git a/packages/@lwc/integration-not-karma/test/component/properties/index.spec.js b/packages/@lwc/integration-not-karma/test/component/properties/index.spec.js index 23dc287617..35b0687a38 100644 --- a/packages/@lwc/integration-not-karma/test/component/properties/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/component/properties/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Component from 'x/component'; -import { ariaProperties } from '../../../helpers/utils.js'; +import { ariaProperties } from '../../../helpers/aria.js'; // This list can grow as we add more properties to the base LightningElement const expectedEnumerableProps = [ diff --git a/packages/@lwc/integration-not-karma/test/light-dom/lifecycle/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/lifecycle/index.spec.js index 5459dc7bf1..fc4c613ee3 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/lifecycle/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/lifecycle/index.spec.js @@ -4,7 +4,8 @@ import SlotForwarding from 'x/slotForwarding'; import DynamicSlotForwarding from 'x/dynamicSlotForwarding'; import StandardSlotting from 'x/standardSlotting'; import BasicContainer from 'x/basicContainer'; -import { extractDataIds, USE_LIGHT_DOM_SLOT_FORWARDING } from '../../../helpers/utils.js'; +import { USE_LIGHT_DOM_SLOT_FORWARDING } from '../../../helpers/constants.js'; +import { extractDataIds } from '../../../helpers/utils.js'; import { resetId } from './util.js'; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/if-block/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/if-block/index.spec.js index 37e781e617..5193e49572 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/if-block/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/if-block/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import MixedSlotParent from 'x/mixedSlotParent'; -import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../../helpers/utils.js'; +import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../../helpers/constants.js'; const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '' : ''; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/index.spec.js index da8841b092..651c5f157d 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/index.spec.js @@ -8,7 +8,7 @@ import NestedSlots from 'x/nestedSlots'; import { USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../helpers/utils.js'; +} from '../../../helpers/constants.js'; const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '' : ''; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/runtime-checks/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/runtime-checks/index.spec.js index 72d598a46b..852be3a16b 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/runtime-checks/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/scoped-slot/runtime-checks/index.spec.js @@ -2,7 +2,7 @@ import { createElement } from 'lwc'; import ParentWithScopedSlotContent from 'x/parentWithScopedSlotContent'; import ParentWithStandardSlotContent from 'x/parentWithStandardSlotContent'; -import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../../helpers/utils.js'; +import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../../helpers/constants.js'; const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '' : ''; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/forwarding/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/forwarding/index.spec.js index 33f9104d31..8cbf78450e 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/forwarding/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/forwarding/index.spec.js @@ -1,9 +1,9 @@ import { createElement } from 'lwc'; import { - extractDataIds, USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; +import { extractDataIds } from '../../../../../helpers/utils.js'; import LightContainer from './x/lightContainer/lightContainer'; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/reactivity/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/reactivity/index.spec.js index e513410048..9c44378338 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/reactivity/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/slot-fowarding/slots/reactivity/index.spec.js @@ -1,5 +1,6 @@ import { createElement } from 'lwc'; -import { extractDataIds, USE_LIGHT_DOM_SLOT_FORWARDING } from '../../../../../helpers/utils.js'; +import { USE_LIGHT_DOM_SLOT_FORWARDING } from '../../../../../helpers/constants.js'; +import { extractDataIds } from '../../../../../helpers/utils.js'; import LightContainer from './x/lightContainer/lightContainer'; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/slotting/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/slotting/index.spec.js index aa28966534..0a428be635 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/slotting/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/slotting/index.spec.js @@ -11,7 +11,7 @@ import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, USE_LIGHT_DOM_SLOT_FORWARDING, USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS, -} from '../../../helpers/utils.js'; +} from '../../../helpers/constants.js'; import { extractDataIds } from '../../../helpers/utils.js'; const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '' : ''; diff --git a/packages/@lwc/integration-not-karma/test/light-dom/synthetic-shadow-styles/index.spec.js b/packages/@lwc/integration-not-karma/test/light-dom/synthetic-shadow-styles/index.spec.js index fd70fb0bd7..b4a0ad29bc 100644 --- a/packages/@lwc/integration-not-karma/test/light-dom/synthetic-shadow-styles/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/light-dom/synthetic-shadow-styles/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Container from 'x/container'; -import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/utils.js'; +import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/constants.js'; // This test only matters for synthetic shadow describe.skipIf(process.env.NATIVE_SHADOW)('Light DOM and synthetic shadow', () => { diff --git a/packages/@lwc/integration-not-karma/test/lwc-on/index.spec.js b/packages/@lwc/integration-not-karma/test/lwc-on/index.spec.js index 982b9e2a2e..b8b53f34b1 100644 --- a/packages/@lwc/integration-not-karma/test/lwc-on/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/lwc-on/index.spec.js @@ -11,7 +11,8 @@ import RerenderLoop from 'x/rerenderLoop'; import PublicProp from 'x/publicProp'; import ComputedKey from 'x/computedKey'; import ValueEvaluationThrows from 'x/ValueEvaluationThrows'; -import { catchUnhandledRejectionsAndErrors, spyConsole } from '../../helpers/utils.js'; +import { spyConsole } from '../../helpers/console.js'; +import { catchUnhandledRejectionsAndErrors } from '../../helpers/utils.js'; describe('lwc:on', () => { it('adds multiple event listeners', () => { diff --git a/packages/@lwc/integration-not-karma/test/misc/object-rest-spread/index.spec.js b/packages/@lwc/integration-not-karma/test/misc/object-rest-spread/index.spec.js index 360f2b91f2..65515fee2e 100644 --- a/packages/@lwc/integration-not-karma/test/misc/object-rest-spread/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/misc/object-rest-spread/index.spec.js @@ -1,4 +1,4 @@ -import { DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION } from '../../../helpers/utils.js'; +import { DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION } from '../../../helpers/constants.js'; // It's useful to have Karma tests for this, so that we confirm legacy browsers still work describe('object rest spread transformation', () => { diff --git a/packages/@lwc/integration-not-karma/test/mixed-shadow-mode/LightningElement.shadowSupportMode/index.spec.js b/packages/@lwc/integration-not-karma/test/mixed-shadow-mode/LightningElement.shadowSupportMode/index.spec.js index 05e4bddffa..3cf9609ce4 100644 --- a/packages/@lwc/integration-not-karma/test/mixed-shadow-mode/LightningElement.shadowSupportMode/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/mixed-shadow-mode/LightningElement.shadowSupportMode/index.spec.js @@ -5,10 +5,10 @@ import Any2 from 'x/any2'; import Invalid from 'x/invalid'; import Valid from 'x/valid'; import NativeOnly from 'x/native'; +import { IS_SYNTHETIC_SHADOW_LOADED } from '../../../helpers/constants.js'; import { isNativeShadowRootInstance, isSyntheticShadowRootInstance, - IS_SYNTHETIC_SHADOW_LOADED, } from '../../../helpers/utils.js'; describe('shadowSupportMode static property', () => { diff --git a/packages/@lwc/integration-not-karma/test/polyfills/aria-properties/index.spec.js b/packages/@lwc/integration-not-karma/test/polyfills/aria-properties/index.spec.js index 81e10ad6fd..d034ae035e 100644 --- a/packages/@lwc/integration-not-karma/test/polyfills/aria-properties/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/polyfills/aria-properties/index.spec.js @@ -3,8 +3,10 @@ import { createElement } from 'lwc'; import Component from 'x/component'; import { ariaPropertiesMapping, - nonStandardAriaProperties, nonPolyfilledAriaProperties, + nonStandardAriaProperties, +} from '../../../helpers/aria.js'; +import { attachReportingControlDispatcher, detachReportingControlDispatcher, } from '../../../helpers/utils.js'; diff --git a/packages/@lwc/integration-not-karma/test/profiler/sanity/profiler.spec.js b/packages/@lwc/integration-not-karma/test/profiler/sanity/profiler.spec.js index bcd976a564..ca4c72f1a0 100644 --- a/packages/@lwc/integration-not-karma/test/profiler/sanity/profiler.spec.js +++ b/packages/@lwc/integration-not-karma/test/profiler/sanity/profiler.spec.js @@ -1,4 +1,8 @@ -import { createElement, hydrateComponent } from 'lwc'; +import { + createElement, + hydrateComponent, + __unstable__ProfilerControl as profilerControl, +} from 'lwc'; import Container from 'x/container'; import Simple from 'x/simple'; @@ -19,8 +23,8 @@ describe('Profiler Sanity Test', () => { }); afterEach(() => { - LWC.__unstable__ProfilerControl.detachDispatcher(); - LWC.__unstable__ProfilerControl.disableProfiler(); + profilerControl.detachDispatcher(); + profilerControl.disableProfiler(); // No marks or measures added by the profiler if (hasPerfMarksAndMeasures) { @@ -86,7 +90,6 @@ describe('Profiler Sanity Test', () => { } function enableProfilerAndRegisterBuffer() { - const profilerControl = LWC.__unstable__ProfilerControl; const events = []; profilerControl.enableProfiler(); profilerControl.attachDispatcher((opId, phase, name, id, renderMode, shadowMode) => { diff --git a/packages/@lwc/integration-not-karma/test/regression/invalid-key/index.spec.js b/packages/@lwc/integration-not-karma/test/regression/invalid-key/index.spec.js index b3e092d5f0..313cd894ef 100644 --- a/packages/@lwc/integration-not-karma/test/regression/invalid-key/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/regression/invalid-key/index.spec.js @@ -1,6 +1,7 @@ import { createElement } from 'lwc'; import ConditionalList from 'x/conditionalList'; -import { extractDataIds, spyConsole } from '../../../helpers/utils.js'; +import { extractDataIds } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; it('W-15885661 - renders list when key is invalid (preserve backwards compat)', async () => { const elm = createElement('x-conditional-list', { is: ConditionalList }); diff --git a/packages/@lwc/integration-not-karma/test/rendering/fragment-cache/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/fragment-cache/index.spec.js index e3690b70c4..db23b2bdcb 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/fragment-cache/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/fragment-cache/index.spec.js @@ -5,7 +5,7 @@ import NativeStyles from 'x/nativeStyles'; import NoStyles from 'x/noStyles'; import ScopedStyles from 'x/scopedStyles'; import Styles from 'x/styles'; -import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/utils.js'; +import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/constants.js'; const scenarios = [ { diff --git a/packages/@lwc/integration-not-karma/test/rendering/legacy-scope-tokens/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/legacy-scope-tokens/index.spec.js index 5b369b5fde..5a293c6192 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/legacy-scope-tokens/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/legacy-scope-tokens/index.spec.js @@ -1,7 +1,7 @@ import { createElement, setFeatureFlagForTest } from 'lwc'; import Light from 'x/light'; import Shadow from 'x/shadow'; -import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/utils.js'; +import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/constants.js'; describe('legacy scope tokens', () => { [false, true].forEach((enableLegacyScopeTokens) => { diff --git a/packages/@lwc/integration-not-karma/test/rendering/scoped-styles-with-existing-class/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/scoped-styles-with-existing-class/index.spec.js index cece772051..b5fb3f973f 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/scoped-styles-with-existing-class/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/scoped-styles-with-existing-class/index.spec.js @@ -1,6 +1,6 @@ import { createElement, setFeatureFlagForTest } from 'lwc'; import Component from 'x/component'; -import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/utils.js'; +import { LOWERCASE_SCOPE_TOKENS } from '../../../helpers/constants.js'; // TODO [#3733]: remove support for legacy scope tokens [false, true].forEach((enableLegacyScopeTokens) => { diff --git a/packages/@lwc/integration-not-karma/test/rendering/side-effects/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/side-effects/index.spec.js index d071787dc3..070b6ba1cc 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/side-effects/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/side-effects/index.spec.js @@ -4,7 +4,7 @@ import SideEffectDuringRender from 'x/sideEffectDuringRender'; import SideEffectDuringTemplate from 'x/sideEffectDuringTemplate'; import SideEffectDuringRenderExternal from 'x/sideEffectDuringRenderExternal'; import SideEffectDuringTemplateExternal from 'x/sideEffectDuringTemplateExternal'; -import { spyConsole } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; describe('side effects', () => { let consoleSpy; diff --git a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/element/light/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/element/light/index.spec.js index a9e6f42e4f..23a6313d26 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/element/light/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/element/light/index.spec.js @@ -1,10 +1,10 @@ import { createElement } from 'lwc'; import Outer from 'x/outer'; import { - expectEquivalentDOM, USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; +import { expectEquivalentDOM } from '../../../../../helpers/utils.js'; // `expectEquivalentDOM` requires `Document.parseHTMLUnsafe` it.runIf(Document.parseHTMLUnsafe)('renders slots not at the top level', async () => { diff --git a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/external/light/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/external/light/index.spec.js index b03fb4aadc..d0b4e6bd6e 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/external/light/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/external/light/index.spec.js @@ -1,10 +1,10 @@ import { createElement } from 'lwc'; import Outer from 'x/outer'; import { - expectEquivalentDOM, USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; +import { expectEquivalentDOM } from '../../../../../helpers/utils.js'; beforeAll(() => { customElements.define('x-external-light', class extends HTMLElement {}); diff --git a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/ifTrue/light/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/ifTrue/light/index.spec.js index 661a39f47c..06c20a9e7f 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/ifTrue/light/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/ifTrue/light/index.spec.js @@ -1,10 +1,10 @@ import { createElement } from 'lwc'; import Outer from 'x/outer'; import { - expectEquivalentDOM, USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; +import { expectEquivalentDOM } from '../../../../../helpers/utils.js'; // `expectEquivalentDOM` requires `Document.parseHTMLUnsafe` it.runIf(Document.parseHTMLUnsafe)('renders slots not at the top level', async () => { diff --git a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/lwcIf/light/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/lwcIf/light/index.spec.js index 661a39f47c..06c20a9e7f 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/lwcIf/light/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/slot-not-at-top-level/lwcIf/light/index.spec.js @@ -1,10 +1,10 @@ import { createElement } from 'lwc'; import Outer from 'x/outer'; import { - expectEquivalentDOM, USE_LIGHT_DOM_SLOT_FORWARDING, USE_COMMENTS_FOR_FRAGMENT_BOOKENDS, -} from '../../../../../helpers/utils.js'; +} from '../../../../../helpers/constants.js'; +import { expectEquivalentDOM } from '../../../../../helpers/utils.js'; // `expectEquivalentDOM` requires `Document.parseHTMLUnsafe` it.runIf(Document.parseHTMLUnsafe)('renders slots not at the top level', async () => { diff --git a/packages/@lwc/integration-not-karma/test/rendering/slotting/index.spec.js b/packages/@lwc/integration-not-karma/test/rendering/slotting/index.spec.js index e7db89f256..f991f890b3 100644 --- a/packages/@lwc/integration-not-karma/test/rendering/slotting/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/rendering/slotting/index.spec.js @@ -5,7 +5,7 @@ import RegressionContainer from 'x/regressionContainer'; import FallbackContentReuseDynamicKeyParent from 'x/fallbackContentReuseDynamicKeyParent'; import UnknownSlotShadow from 'x/unknownSlotShadow'; import UnknownSlotLight from 'x/unknownSlotLight'; -import { spyConsole } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; // TODO [#1617]: Engine currently has trouble with slotting and invocation of the renderedCallback. xit('should not render if the slotted content changes', () => { diff --git a/packages/@lwc/integration-not-karma/test/signal/protocol/x/signal/signal.js b/packages/@lwc/integration-not-karma/test/signal/protocol/x/signal/signal.js index 27a1f7b098..abfc1627cd 100644 --- a/packages/@lwc/integration-not-karma/test/signal/protocol/x/signal/signal.js +++ b/packages/@lwc/integration-not-karma/test/signal/protocol/x/signal/signal.js @@ -1,7 +1,7 @@ // Note for testing purposes the signal implementation uses LWC module resolution to simplify things. // In production the signal will come from a 3rd party library. -import { addTrustedSignal } from '../../../../../helpers/utils.js'; +import { addTrustedSignal } from '../../../../../helpers/signals.js'; export class Signal { subscribers = new Set(); diff --git a/packages/@lwc/integration-not-karma/test/signal/reactivity/x/signal/signal.js b/packages/@lwc/integration-not-karma/test/signal/reactivity/x/signal/signal.js index c174e53d93..d56372c37c 100644 --- a/packages/@lwc/integration-not-karma/test/signal/reactivity/x/signal/signal.js +++ b/packages/@lwc/integration-not-karma/test/signal/reactivity/x/signal/signal.js @@ -1,7 +1,7 @@ // Note for testing purposes the signal implementation uses LWC module resolution to simplify things. // In production the signal will come from a 3rd party library. -import { addTrustedSignal } from '../../../../../helpers/utils.js'; +import { addTrustedSignal } from '../../../../../helpers/signals.js'; export class Signal { subscribers = new Set(); diff --git a/packages/@lwc/integration-not-karma/test/spread/index.spec.js b/packages/@lwc/integration-not-karma/test/spread/index.spec.js index a093933ad1..f45edc21fe 100644 --- a/packages/@lwc/integration-not-karma/test/spread/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/spread/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Test from 'x/test'; -import { getHooks, setHooks } from '../../helpers/utils.js'; +import { getHooks, setHooks } from '../../helpers/hooks.js'; function setSanitizeHtmlContentHookForTest(impl) { const { sanitizeHtmlContent } = getHooks(); diff --git a/packages/@lwc/integration-not-karma/test/static-content/index.spec.js b/packages/@lwc/integration-not-karma/test/static-content/index.spec.js index a38d7c1a2a..0c85aba582 100644 --- a/packages/@lwc/integration-not-karma/test/static-content/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/static-content/index.spec.js @@ -23,7 +23,8 @@ import Text from 'x/text'; import TableWithExpression from 'x/tableWithExpressions'; import TextWithoutPreserveComments from 'x/textWithoutPreserveComments'; import TextWithPreserveComments from 'x/textWithPreserveComments'; -import { extractDataIds, LOWERCASE_SCOPE_TOKENS } from '../../helpers/utils.js'; +import { LOWERCASE_SCOPE_TOKENS } from '../../helpers/constants.js'; +import { extractDataIds } from '../../helpers/utils.js'; describe.skipIf(process.env.NATIVE_SHADOW)('Mixed mode for static content', () => { ['native', 'synthetic'].forEach((firstRenderMode) => { diff --git a/packages/@lwc/integration-not-karma/test/synthetic-shadow/disable-synthetic-shadow/index.spec.js b/packages/@lwc/integration-not-karma/test/synthetic-shadow/disable-synthetic-shadow/index.spec.js index d34fa47233..d68723e254 100644 --- a/packages/@lwc/integration-not-karma/test/synthetic-shadow/disable-synthetic-shadow/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/synthetic-shadow/disable-synthetic-shadow/index.spec.js @@ -1,9 +1,7 @@ import { createElement, setFeatureFlagForTest } from 'lwc'; import Component from 'x/component'; -import { - IS_SYNTHETIC_SHADOW_LOADED, - isSyntheticShadowRootInstance, -} from '../../../helpers/utils.js'; +import { IS_SYNTHETIC_SHADOW_LOADED } from '../../../helpers/constants.js'; +import { isSyntheticShadowRootInstance } from '../../../helpers/utils.js'; describe.runIf(IS_SYNTHETIC_SHADOW_LOADED && !process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST)( 'DISABLE_SYNTHETIC_SHADOW', diff --git a/packages/@lwc/integration-not-karma/test/synthetic-shadow/shadow-token/index.spec.js b/packages/@lwc/integration-not-karma/test/synthetic-shadow/shadow-token/index.spec.js index da8ca50807..7569c2e1f6 100644 --- a/packages/@lwc/integration-not-karma/test/synthetic-shadow/shadow-token/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/synthetic-shadow/shadow-token/index.spec.js @@ -1,4 +1,4 @@ -import { IS_SYNTHETIC_SHADOW_LOADED } from '../../../helpers/utils.js'; +import { IS_SYNTHETIC_SHADOW_LOADED } from '../../../helpers/constants.js'; // From @lwc/shared/src/keys.ts const KEY__SHADOW_RESOLVER = '$shadowResolver$'; diff --git a/packages/@lwc/integration-not-karma/test/template/attribute-aria/index.spec.js b/packages/@lwc/integration-not-karma/test/template/attribute-aria/index.spec.js index 18d67c58ea..6b01e44a49 100644 --- a/packages/@lwc/integration-not-karma/test/template/attribute-aria/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/template/attribute-aria/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import Parent from 'x/parent'; -import { ariaAttributes, ariaProperties, ariaPropertiesMapping } from '../../../helpers/utils.js'; +import { ariaAttributes, ariaProperties, ariaPropertiesMapping } from '../../../helpers/aria.js'; describe('setting aria attributes', () => { let childComponent; diff --git a/packages/@lwc/integration-not-karma/test/template/attribute-aria/x/child/child.js b/packages/@lwc/integration-not-karma/test/template/attribute-aria/x/child/child.js index 6ce64f4ed8..483e00e976 100644 --- a/packages/@lwc/integration-not-karma/test/template/attribute-aria/x/child/child.js +++ b/packages/@lwc/integration-not-karma/test/template/attribute-aria/x/child/child.js @@ -1,5 +1,5 @@ import { LightningElement, api } from 'lwc'; -import { ariaProperties } from '../../../../../helpers/utils.js'; +import { ariaProperties } from '../../../../../helpers/aria.js'; export default class extends LightningElement { @api diff --git a/packages/@lwc/integration-not-karma/test/template/attribute-class/object-values.spec.js b/packages/@lwc/integration-not-karma/test/template/attribute-class/object-values.spec.js index ac9550e6f8..bb83540905 100644 --- a/packages/@lwc/integration-not-karma/test/template/attribute-class/object-values.spec.js +++ b/packages/@lwc/integration-not-karma/test/template/attribute-class/object-values.spec.js @@ -2,7 +2,7 @@ import { createElement } from 'lwc'; import Dynamic from 'x/dynamic'; import Reactive from 'x/reactive'; -import { TEMPLATE_CLASS_NAME_OBJECT_BINDING } from '../../../helpers/utils.js'; +import { TEMPLATE_CLASS_NAME_OBJECT_BINDING } from '../../../helpers/constants.js'; function createDynamicClass(value) { const elm = createElement('x-dynamic', { is: Dynamic }); diff --git a/packages/@lwc/integration-not-karma/test/template/directive-for-each/index.spec.js b/packages/@lwc/integration-not-karma/test/template/directive-for-each/index.spec.js index dca99a8b84..3dee1e468e 100644 --- a/packages/@lwc/integration-not-karma/test/template/directive-for-each/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/template/directive-for-each/index.spec.js @@ -3,7 +3,7 @@ import XTest from 'x/test'; import XTestStatic from 'x/testStatic'; import XTestCustomElement from 'x/testCustomElement'; import ArrayNullPrototype from 'x/arrayNullPrototype'; -import { spyConsole } from '../../../helpers/utils.js'; +import { spyConsole } from '../../../helpers/console.js'; function testForEach(type, obj) { it(`should render ${type}`, () => { diff --git a/packages/@lwc/integration-not-karma/test/template/directive-lwc-inner-html/index.spec.js b/packages/@lwc/integration-not-karma/test/template/directive-lwc-inner-html/index.spec.js index e612ce814c..8f9a804a4d 100644 --- a/packages/@lwc/integration-not-karma/test/template/directive-lwc-inner-html/index.spec.js +++ b/packages/@lwc/integration-not-karma/test/template/directive-lwc-inner-html/index.spec.js @@ -1,6 +1,6 @@ import { createElement } from 'lwc'; import XInnerHtml from 'x/innerHtml'; -import { getHooks, setHooks } from '../../../helpers/utils.js'; +import { getHooks, setHooks } from '../../../helpers/hooks.js'; let originalSanitizeHtmlContent;