Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8c7ed79
test(wtr): update tests to use relative path to utils
wjhsf Aug 28, 2025
e2f88d5
test(wtr): revert removing TestUtils
wjhsf Sep 2, 2025
81275d0
test(wtr): remove useless describe
wjhsf Sep 2, 2025
39533d3
test(wtr): replace IIFE script with module import
wjhsf Sep 2, 2025
33e58c8
test(wtr): clean up SSR execution script
wjhsf Sep 2, 2025
d0b8003
test(wtr): always use DISABLE_SYNTHETIC
wjhsf Sep 3, 2025
976c002
test(wtr): enable all hydration tests
wjhsf Sep 3, 2025
8d39505
Merge branch 'master' into wjh/wtr-hyd
wjhsf Sep 4, 2025
c66afad
test(wtr): remove side effect from signals helper
wjhsf Sep 4, 2025
f1c50b0
test(wtr): import directly from file, not from barrel exporter
wjhsf Sep 4, 2025
7a73bf0
test(wtr): change bulk export statement to individual exports
wjhsf Sep 4, 2025
9b7b21b
test(wtr): remove unnecessary aria re-export
wjhsf Sep 4, 2025
9deaca2
test(wtr): fix a few more ARIA util imports
wjhsf Sep 4, 2025
1cf1275
chore: move comment for nicer aesthetic
wjhsf Sep 4, 2025
7fc137c
test(wtr): remove unused option
wjhsf Sep 4, 2025
ae937cc
test(wtr): fix another ARIA util import
wjhsf Sep 4, 2025
9250dd5
test(wtr): import directly from hooks file rather than utils
wjhsf Sep 4, 2025
d4280e8
test(wtr): import directly from signals file rather than utils
wjhsf Sep 4, 2025
bbffbf3
test(wtr): import directly from console helper rather than utils
wjhsf Sep 4, 2025
1ef88ed
test(wtr): import directly from constants helper rather than utils
wjhsf Sep 4, 2025
02f8ed1
test(wtr): only import what is needed from LWC
wjhsf Sep 4, 2025
7a5260a
test(wtr): split lwc:dynamic load helpers into separate file
wjhsf Sep 4, 2025
1a08a62
test(wtr): avoid relying on global LWC
wjhsf Sep 4, 2025
f14c829
Merge branch 'master' into wjh/wtr-smaller-utils
wjhsf Sep 9, 2025
289deeb
Merge branch 'master' into wjh/wtr-smaller-utils
wjhsf Sep 9, 2025
b97f783
test(wtr): remove unnecessary wrapping of hydration test config
wjhsf Sep 9, 2025
3cdb65c
test(wtr): remove test-utils logic from resolveImport
wjhsf Sep 9, 2025
7009a26
test(wtr): move plugin from shared config to only config that uses it
wjhsf Sep 9, 2025
19c1090
test(wtr): remove useless guid
wjhsf Sep 9, 2025
5e75329
test(wtr): remove unnecessary test-utils global
wjhsf Sep 9, 2025
497bfa8
test(wtr): clean up component definition
wjhsf Sep 9, 2025
8ff59c5
test(wtr): change component in test from IIFE to import
wjhsf Sep 11, 2025
885ce57
test(wtr): shift logic out of wrapper into static test runner file
wjhsf Sep 11, 2025
aa47c49
test(wtr): make test setup/teardown more idiomatic
wjhsf Sep 11, 2025
6185811
test(wtr): clean up module compilation
wjhsf Sep 11, 2025
ec0186f
chore(wtr): make dependency on @vitest/spy explicit
wjhsf Sep 11, 2025
3463450
test(wtr): remove console suppression
wjhsf Sep 11, 2025
7c0eb0a
test(wtr): clean up names and comments
wjhsf Sep 11, 2025
d91c8aa
Merge branch 'master' into wjh/wtr-clean-hydration
wjhsf Sep 11, 2025
371032d
Merge branch 'master' into wjh/wtr-clean-hydration
wjhsf Sep 12, 2025
c47a44d
test(wtr): move and rename file
wjhsf Sep 12, 2025
639f754
Merge branch 'master' into wjh/wtr-clean-hydration
wjhsf Sep 12, 2025
c21a895
test(wtr): remove usage of global TestUtils from hydration tests
wjhsf Sep 12, 2025
d041a23
test(wtr): remove LWC import from utils
wjhsf Sep 12, 2025
cb6213c
test(wtr): remove unused external deps
wjhsf Sep 12, 2025
76efacb
test(wtr): use imports instead of jasmine globals
wjhsf Sep 12, 2025
e86cbc4
chore(eslint): remove unused rule config
wjhsf Sep 12, 2025
2ce37f2
Merge branch 'master' into wjh/wtr-less-jasmine
wjhsf Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,8 @@ export default tseslint.config(
lwcRuntimeFlags: true,
process: true,
...globals.browser,
...globals.jasmine,
},
},

rules: {
'no-var': 'off',
'prefer-rest-params': 'off',
},
},
{
files: ['packages/@lwc/integration-karma/**'],
Expand All @@ -384,11 +378,6 @@ export default tseslint.config(
...globals.jasmine,
},
},

rules: {
'no-var': 'off',
'prefer-rest-params': 'off',
},
},
{
files: ['packages/@lwc/synthetic-shadow/**'],
Expand Down
37 changes: 37 additions & 0 deletions packages/@lwc/integration-not-karma/helpers/jasmine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { spyOn, fn } from '@vitest/spy';

/**
* Adds the jasmine interfaces we use in the Karma tests to a Vitest spy.
* Should ultimately be removed and tests updated to use Vitest spies.
* @param {import('@vitest/spy').MockInstance}
*/
function jasmineSpyAdapter(spy) {
Object.defineProperties(spy, {
and: { get: () => spy },
calls: { get: () => spy.mock.calls },
returnValue: { value: () => spy.mockReturnValue() },
// calling mockImplementation() with nothing restores the original
callThrough: { value: () => spy.mockImplementation() },
callFake: { value: (impl) => spy.mockImplementation(impl) },
});

Object.defineProperties(spy.mock.calls, {
// Must be non-enumerable for equality checks to work on array literal expected values
allArgs: { value: () => spy.mock.calls },
count: { value: () => spy.mock.calls.length },
reset: { value: () => spy.mockReset() },
argsFor: { value: (index) => spy.mock.calls.at(index) },
});

return spy;
}

export const jasmineSpyOn = (object, prop) => jasmineSpyAdapter(spyOn(object, prop));
export const jasmine = {
any: expect.any,
arrayWithExactContents: () => {
throw new Error('TODO: jasmine.arrayWithExactContents');
},
createSpy: (name, impl) => jasmineSpyAdapter(fn(impl)),
objectContaining: expect.objectContaining,
};
37 changes: 0 additions & 37 deletions packages/@lwc/integration-not-karma/helpers/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// 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 { spyOn, fn } from '@vitest/spy';
import { registerCustomMatchers } from './matchers/index.js';
import { initSignals } from './signals.js';

Expand All @@ -15,44 +14,8 @@ chai.use(JestChaiExpect);
chai.use(JestAsymmetricMatchers);
// add our custom matchers
chai.use(registerCustomMatchers);

/**
* Adds the jasmine interfaces we use in the Karma tests to a Vitest spy.
* Should ultimately be removed and tests updated to use Vitest spies.
* @param {import('@vitest/spy').MockInstance}
*/
function jasmineSpyAdapter(spy) {
Object.defineProperties(spy, {
and: { get: () => spy },
calls: { get: () => spy.mock.calls },
returnValue: { value: () => spy.mockReturnValue() },
// calling mockImplementation() with nothing restores the original
callThrough: { value: () => spy.mockImplementation() },
callFake: { value: (impl) => spy.mockImplementation(impl) },
});

Object.defineProperties(spy.mock.calls, {
// Must be non-enumerable for equality checks to work on array literal expected values
allArgs: { value: () => spy.mock.calls },
count: { value: () => spy.mock.calls.length },
reset: { value: () => spy.mockReset() },
argsFor: { value: (index) => spy.mock.calls.at(index) },
});

return spy;
}

// expose so we don't need to import `expect` in every test file
globalThis.expect = chai.expect;
globalThis.spyOn = (object, prop) => jasmineSpyAdapter(spyOn(object, prop));
globalThis.jasmine = {
any: expect.any,
arrayWithExactContents: () => {
throw new Error('TODO: jasmine.arrayWithExactContents');
},
createSpy: (name, impl) => jasmineSpyAdapter(fn(impl)),
objectContaining: expect.objectContaining,
};

/**
* `@web/test-runner-mocha`'s autorun.js file inlines its own copy of mocha, and there's no direct
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';
import Light from 'x/light';
import Shadow from 'x/shadow';
import { jasmine } from '../../../helpers/jasmine.js';
import { nonStandardAriaProperties } from '../../../helpers/aria.js';
import {
attachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createElement } from 'lwc';

import AriaContainer from 'x/ariaContainer';
import Valid from 'x/valid';
import { jasmine } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerTemplate, freezeTemplate, setFeatureFlagForTest } from 'lwc';
import { jasmine } from '../../../helpers/jasmine.js';

import {
attachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PublicPropertiesInheritance from 'x/publicPropertiesInheritance';
import PublicMethodsInheritance from 'x/publicMethodsInheritance';
import PrivateAccessors from 'x/privateAccessors';
import HtmlElementProps from 'x/htmlElementProps';
import { jasmine } from '../../../helpers/jasmine.js';
import { ariaProperties } from '../../../helpers/aria.js';

function testInvalidComponentConstructor(name, ctor) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement, isNodeFromTemplate } from 'lwc';
import Test from 'x/test';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

function testNonNodes(type, obj) {
it(`should return false if the passed object if a ${type}`, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import XInnerHtml from 'x/innerHtml';
import { jasmine } from '../../../helpers/jasmine.js';
import { getHooks, setHooks } from '../../../helpers/hooks.js';

const ACTUAL_CONTENT = 'Hello <b>World</b>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Test from 'x/test';
import DisconnectedCallbackThrow from 'x/disconnectedCallbackThrow';
import DualTemplate from 'x/dualTemplate';
import ExplicitRender from 'x/explicitRender';
import { jasmine } from '../../../helpers/jasmine.js';
import { customElementCallbackReactionErrorListener } from '../../../helpers/utils.js';

function testDisconnectSlot(name, fn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createElement, setFeatureFlagForTest } from 'lwc';
import Component from 'x/component';
import Parent from 'x/parent';
import LogsWhenConnected from 'x/logsWhenConnected';
import { jasmine, jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';
import { installCustomContext, setCustomContext } from 'x/simpleProvider';
import Consumer from 'x/simpleConsumer';
import { jasmine } from '../../helpers/jasmine.js';

describe('Simple Custom Context Provider', () => {
it('should be install-able on any dom element', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createElement, setFeatureFlagForTest } from 'lwc';
import LockerIntegration from 'x/lockerIntegration';
import LockerLiveComponent from 'x/lockerLiveComponent';
import LockerHooks, { hooks } from 'x/lockerHooks';
import { jasmine, jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';
beforeEach(() => {
setFeatureFlagForTest('LEGACY_LOCKER_ENABLED', true);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import MixedSlotParent from 'x/mixedSlotParent';
import { jasmineSpyOn as spyOn } from '../../../../helpers/jasmine.js';
import { USE_COMMENTS_FOR_FRAGMENT_BOOKENDS } from '../../../../helpers/constants.js';

const vFragBookend = USE_COMMENTS_FOR_FRAGMENT_BOOKENDS ? '<!---->' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import RerenderLoop from 'x/rerenderLoop';
import PublicProp from 'x/publicProp';
import ComputedKey from 'x/computedKey';
import ValueEvaluationThrows from 'x/ValueEvaluationThrows';
import { jasmine } from '../../helpers/jasmine.js';
import { spyConsole } from '../../helpers/console.js';
import { catchUnhandledRejectionsAndErrors } from '../../helpers/utils.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Parent from 'x/parent';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

describe('vdom removes component while it is already disconnected', () => {
let spy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Test from 'x/test';
import { jasmine } from '../../../helpers/jasmine.js';

describe('event.composedPath() of event dispatched from closed shadow root', () => {
it('should have shadowed elements when invoked inside the shadow root', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createElement } from 'lwc';
import Component from 'x/component';
import Parent from 'x/parent';
import Light from 'x/light';
import { jasmine } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Any from 'x/any';
import Reset from 'x/reset';
import None from 'x/none';
import NativeOnly from 'x/native';
import { jasmine } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';

import Component from 'x/component';
import { jasmine } from '../../../helpers/jasmine.js';
import {
ariaPropertiesMapping,
nonPolyfilledAriaProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';
import XTest from 'x/test';
import XWithLwcDomManual from 'x/withLwcDomManual';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

describe('should not provide access to elements inside shadow tree', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createElement } from 'lwc';
import Parent from 'x/parent';
import Child from 'x/child';
import GetterThrows from 'x/getterThrows';
import { jasmine, jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

const arr = jasmine.arrayWithExactContents;
// `jasmine.objectContaining` is long, but the method can't be detached/aliased, ergo wrapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Component from 'x/component';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

let spy;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';
import Inner from 'x/inner';
import Outer from 'x/outer';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';
import { extractDataIds } from '../../../helpers/utils.js';

beforeAll(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement, setFeatureFlagForTest } from 'lwc';
import Component from 'x/component';
import Scoping from 'x/scoping';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';
import { catchUnhandledRejectionsAndErrors } from '../../../helpers/utils.js';

let caughtError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createElement, LightningElement, registerTemplate, registerComponent }
import Component from 'x/component';
import ComponentWithProp from 'x/componentWithProp';
import ComponentWithTemplateAndStylesheet from 'x/componentWithTemplateAndStylesheet';
import { jasmine } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Slotted from 'x/slotted';
import Nested from 'x/nested';
import NestedFallback from 'x/nestedFallback';
import TestWithDiv from 'x/testWithDiv';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

describe('Element.querySelector', () => {
it('should return null if no Element match', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';

import Container from 'x/container';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

describe('Event.target', () => {
let globalListener = () => {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Container from 'x/container';
import { jasmine } from '../../../helpers/jasmine.js';
import { extractDataIds } from '../../../helpers/utils.js';

function createShadowTree(parentNode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Container from 'x/container';
import { jasmine } from '../../../helpers/jasmine.js';
import { extractDataIds } from '../../../helpers/utils.js';

function createShadowTree(parentNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import XParent from 'x/parent';
import XSlottedChild from 'x/slottedChild';
import XNestedSlotContainer from 'x/nestedSlotContainer';
import XTemplateMutations from 'x/templateMutations';
import { jasmine } from '../../../helpers/jasmine.js';

const observerConfig = { childList: true, subtree: true };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import WithLwcDomManualNested from 'x/withLwcDomManualNested';
import WithLwcDomManual from 'x/withLwcDomManual';
import WithoutLwcDomManual from 'x/withoutLwcDomManual';
import Text from 'x/text';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

const composedTrueConfig = { composed: true };
describe('Node.getRootNode', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Throws from 'x/throws';
// 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 { Signal } from 'x/signal';
import { jasmine } from '../../../helpers/jasmine.js';

describe('signal protocol', () => {
beforeAll(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createElement } from 'lwc';
import Test from 'x/test';
import { jasmine, jasmineSpyOn as spyOn } from '../../helpers/jasmine.js';
import { getHooks, setHooks } from '../../helpers/hooks.js';

function setSanitizeHtmlContentHookForTest(impl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Text from 'x/text';
import TableWithExpression from 'x/tableWithExpressions';
import TextWithoutPreserveComments from 'x/textWithoutPreserveComments';
import TextWithPreserveComments from 'x/textWithPreserveComments';
import { jasmine } from '../../helpers/jasmine.js';
import { LOWERCASE_SCOPE_TOKENS } from '../../helpers/constants.js';
import { extractDataIds } from '../../helpers/utils.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createElement } from 'lwc';

import Container from 'x/container';
import ParentSpecialized from 'x/parentSpecialized';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

/*
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createElement } from 'lwc';
import withLwcDomManual from 'x/withLwcDomManual';
import withoutLwcDomManual from 'x/withoutLwcDomManual';
import SvgWithLwcDomManual from 'x/svgWithLwcDomManual';
import { jasmineSpyOn as spyOn } from '../../../helpers/jasmine.js';

function waitForStyleToBeApplied() {
return Promise.resolve();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createElement } from 'lwc';
import Shadow from 'x/shadow';
import Light from 'x/light';
import { jasmine } from '../../../helpers/jasmine.js';
import {
attachReportingControlDispatcher,
detachReportingControlDispatcher,
Expand Down