Skip to content

Commit 6081b89

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/jsdom-27.0.0
2 parents ed11229 + 9ec20a2 commit 6081b89

File tree

99 files changed

+334
-143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+334
-143
lines changed

.nucleus.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
core-deploy:
2+
enabled: true
3+
project-modules:
4+
lwc: lwc.version
5+
branches:
6+
~DEFAULT~:
7+
pull-request: &branch-definition
8+
workflow: build-and-test
9+
auto-start: true
10+
auto-start-from-forks: false
11+
merge-method: disabled # do not auto-merge; we'll do it ourselves
12+
required-downstream-deps:
13+
- BuilderFramework/builder-framework-salesforce
14+
- MobilePlatform/lsdk-modules
15+
- MobilePlatform/lwr-lightning-platform
16+
- MobilePlatform/ui-fsm-components
17+
- automation-platform/ui-externalservices-builder-components
18+
- communities/microsite-template-marketing
19+
- communities/shared-experience-components
20+
- communities/ui-commerce-components
21+
- communities/webruntime
22+
- lds/lds-plugins
23+
- salesforce-experience-platform-emu/komaci
24+
- salesforce-experience-platform-emu/locker-pentest-app
25+
- salesforce-experience-platform-emu/lwr
26+
- salesforce-experience-platform-emu/lwr-everywhere
27+
- salesforce-experience-platform-emu/lwr-recipes
28+
- salesforce/lwc-test
29+
# Using old major versions; tests in PRs will always fail
30+
# - salesforce/o11y-sample-app
31+
# - Skilling-and-Enablement/ui-external-enablement
32+
release:
33+
pull-request:
34+
<<: *branch-definition
35+
# Only active branches need to be included in this config
36+
winter26:
37+
pull-request:
38+
<<: *branch-definition
39+
spring25:
40+
pull-request:
41+
<<: *branch-definition
42+
summer25:
43+
pull-request:
44+
<<: *branch-definition
45+
jobs:
46+
build-and-test:
47+
memory-limit: 16
48+
create-canary-release:
49+
memory-limit: 16
50+
build-dependency:
51+
memory-limit: 16
52+
release:
53+
memory-limit: 16
54+
steps:
55+
node-conformance:
56+
run:
57+
command: yarn run lint
58+
after: node-build
59+
node-unit-tests:
60+
run:
61+
command: yarn test
62+
# this project runs yarn build after yarn install so skip explicit build step
63+
node-build: &node-build
64+
skip: true

eslint.config.mjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -361,16 +361,9 @@ export default tseslint.config(
361361
globals: {
362362
lwcRuntimeFlags: true,
363363
process: true,
364-
TestUtils: true,
365364
...globals.browser,
366-
...globals.jasmine,
367365
},
368366
},
369-
370-
rules: {
371-
'no-var': 'off',
372-
'prefer-rest-params': 'off',
373-
},
374367
},
375368
{
376369
files: ['packages/@lwc/integration-karma/**'],
@@ -385,11 +378,6 @@ export default tseslint.config(
385378
...globals.jasmine,
386379
},
387380
},
388-
389-
rules: {
390-
'no-var': 'off',
391-
'prefer-rest-params': 'off',
392-
},
393381
},
394382
{
395383
files: ['packages/@lwc/synthetic-shadow/**'],

packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function compileModule(input, targetSSR, format) {
5050
}),
5151
],
5252

53-
external: ['lwc', '@lwc/ssr-runtime', 'test-utils', '@test/loader'], // @todo: add ssr modules for test-utils and @test/loader
53+
external: ['lwc', '@lwc/ssr-runtime'],
5454

5555
onwarn(warning, warn) {
5656
// Ignore warnings from our own Rollup plugin

packages/@lwc/integration-not-karma/configs/plugins/serve-integration.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ const transform = async (ctx) => {
8484
cache,
8585
plugins: [customLwcRollupPlugin],
8686

87-
// Rollup should not attempt to resolve the engine and the test utils, Karma takes care of injecting it
88-
// globally in the page before running the tests.
8987
external: [
9088
'lwc',
9189
'wire-service',
92-
'@test/loader',
9390
// Some helper files export functions that mutate a global state. The setup file calls
9491
// some of those functions and does not get bundled. Including the helper files in the
9592
// bundle would create a separate global state, causing tests to fail. We don't need to
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { spyOn, fn } from '@vitest/spy';
2+
3+
/**
4+
* Adds the jasmine interfaces we use in the Karma tests to a Vitest spy.
5+
* Should ultimately be removed and tests updated to use Vitest spies.
6+
* @param {import('@vitest/spy').MockInstance}
7+
*/
8+
function jasmineSpyAdapter(spy) {
9+
Object.defineProperties(spy, {
10+
and: { get: () => spy },
11+
calls: { get: () => spy.mock.calls },
12+
returnValue: { value: () => spy.mockReturnValue() },
13+
// calling mockImplementation() with nothing restores the original
14+
callThrough: { value: () => spy.mockImplementation() },
15+
callFake: { value: (impl) => spy.mockImplementation(impl) },
16+
});
17+
18+
Object.defineProperties(spy.mock.calls, {
19+
// Must be non-enumerable for equality checks to work on array literal expected values
20+
allArgs: { value: () => spy.mock.calls },
21+
count: { value: () => spy.mock.calls.length },
22+
reset: { value: () => spy.mockReset() },
23+
argsFor: { value: (index) => spy.mock.calls.at(index) },
24+
});
25+
26+
return spy;
27+
}
28+
29+
export const jasmineSpyOn = (object, prop) => jasmineSpyAdapter(spyOn(object, prop));
30+
export const jasmine = {
31+
any: expect.any,
32+
arrayWithExactContents: () => {
33+
throw new Error('TODO: jasmine.arrayWithExactContents');
34+
},
35+
createSpy: (name, impl) => jasmineSpyAdapter(fn(impl)),
36+
objectContaining: expect.objectContaining,
37+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { __unstable__ReportingControl } from 'lwc';
2+
3+
/**
4+
*
5+
* @param dispatcher
6+
* @param runtimeEvents List of runtime events to filter by. If no list is provided, all events will be dispatched.
7+
*/
8+
export function attachReportingControlDispatcher(dispatcher, runtimeEvents) {
9+
__unstable__ReportingControl.attachDispatcher((eventName, payload) => {
10+
if (!runtimeEvents || runtimeEvents.includes(eventName)) {
11+
dispatcher(eventName, payload);
12+
}
13+
});
14+
}
15+
16+
export function detachReportingControlDispatcher() {
17+
__unstable__ReportingControl.detachDispatcher();
18+
}

packages/@lwc/integration-not-karma/helpers/setup.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// This import ensures that the global `Mocha` object is present for mutation.
22
import { JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expect';
33
import * as chai from 'chai';
4-
import { spyOn, fn } from '@vitest/spy';
54
import { registerCustomMatchers } from './matchers/index.js';
6-
import * as TestUtils from './utils.js';
75
import { initSignals } from './signals.js';
86

97
initSignals();
108

11-
// FIXME: As a relic of the Karma tests, some test files rely on the global object,
12-
// rather than importing from `test-utils`.
13-
window.TestUtils = TestUtils;
14-
159
// allows using expect.extend instead of chai.use to extend plugins
1610
chai.use(JestExtend);
1711
// adds all jest matchers to expect
@@ -20,44 +14,8 @@ chai.use(JestChaiExpect);
2014
chai.use(JestAsymmetricMatchers);
2115
// add our custom matchers
2216
chai.use(registerCustomMatchers);
23-
24-
/**
25-
* Adds the jasmine interfaces we use in the Karma tests to a Vitest spy.
26-
* Should ultimately be removed and tests updated to use Vitest spies.
27-
* @param {import('@vitest/spy').MockInstance}
28-
*/
29-
function jasmineSpyAdapter(spy) {
30-
Object.defineProperties(spy, {
31-
and: { get: () => spy },
32-
calls: { get: () => spy.mock.calls },
33-
returnValue: { value: () => spy.mockReturnValue() },
34-
// calling mockImplementation() with nothing restores the original
35-
callThrough: { value: () => spy.mockImplementation() },
36-
callFake: { value: (impl) => spy.mockImplementation(impl) },
37-
});
38-
39-
Object.defineProperties(spy.mock.calls, {
40-
// Must be non-enumerable for equality checks to work on array literal expected values
41-
allArgs: { value: () => spy.mock.calls },
42-
count: { value: () => spy.mock.calls.length },
43-
reset: { value: () => spy.mockReset() },
44-
argsFor: { value: (index) => spy.mock.calls.at(index) },
45-
});
46-
47-
return spy;
48-
}
49-
5017
// expose so we don't need to import `expect` in every test file
5118
globalThis.expect = chai.expect;
52-
globalThis.spyOn = (object, prop) => jasmineSpyAdapter(spyOn(object, prop));
53-
globalThis.jasmine = {
54-
any: expect.any,
55-
arrayWithExactContents: () => {
56-
throw new Error('TODO: jasmine.arrayWithExactContents');
57-
},
58-
createSpy: (name, impl) => jasmineSpyAdapter(fn(impl)),
59-
objectContaining: expect.objectContaining,
60-
};
6119

6220
/**
6321
* `@web/test-runner-mocha`'s autorun.js file inlines its own copy of mocha, and there's no direct

packages/@lwc/integration-not-karma/helpers/utils.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/*
22
* An as yet uncategorized mishmash of helpers, relics of Karma
33
*/
4-
import { __unstable__ReportingControl } from 'lwc';
54

65
// Listen for errors thrown directly by the callback
76
function directErrorListener(callback) {
@@ -47,23 +46,6 @@ export function customElementCallbackReactionErrorListener(callback) {
4746
: windowErrorListener(callback);
4847
}
4948

50-
/**
51-
*
52-
* @param dispatcher
53-
* @param runtimeEvents List of runtime events to filter by. If no list is provided, all events will be dispatched.
54-
*/
55-
export function attachReportingControlDispatcher(dispatcher, runtimeEvents) {
56-
__unstable__ReportingControl.attachDispatcher((eventName, payload) => {
57-
if (!runtimeEvents || runtimeEvents.includes(eventName)) {
58-
dispatcher(eventName, payload);
59-
}
60-
});
61-
}
62-
63-
export function detachReportingControlDispatcher() {
64-
__unstable__ReportingControl.detachDispatcher();
65-
}
66-
6749
export function extractDataIds(root) {
6850
const nodes = {};
6951

packages/@lwc/integration-not-karma/test-hydration/attributes/falsy-mismatch/index.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { expectConsoleCallsDev } from '../../../helpers/utils.js';
2+
13
export default {
24
props: {
35
isFalse: false,
@@ -28,7 +30,7 @@ export default {
2830
expect(divs[i].getAttribute('data-foo')).toEqual(expectedAttrValues[i]);
2931
}
3032

31-
TestUtils.expectConsoleCallsDev(consoleCalls, {
33+
expectConsoleCallsDev(consoleCalls, {
3234
error: [],
3335
warn: [
3436
'Hydration attribute mismatch on: <div> - rendered on server: data-foo=null - expected on client: data-foo="undefined"',

packages/@lwc/integration-not-karma/test-hydration/context/index.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { expectConsoleCalls } from '../../helpers/utils.js';
2+
13
export default {
24
// server is expected to generate the same console error as the client
35
expectedSSRConsoleCalls: {
@@ -40,7 +42,7 @@ export default {
4042
// Expect an error as one context was generated twice.
4143
// Expect an error as one context was malformed (did not define connectContext or disconnectContext methods).
4244
// Expect server/client context output parity (no hydration warnings)
43-
TestUtils.expectConsoleCalls(consoleCalls, {
45+
expectConsoleCalls(consoleCalls, {
4446
error: [],
4547
warn: [
4648
'Attempted to connect to trusted context but received the following error',

0 commit comments

Comments
 (0)