Skip to content

test(wtr): replace TestUtils/test-utils with regular file module#5476

Merged
wjhsf merged 7 commits intomasterfrom
wjh/wtrrrr
Sep 2, 2025
Merged

test(wtr): replace TestUtils/test-utils with regular file module#5476
wjhsf merged 7 commits intomasterfrom
wjh/wtrrrr

Conversation

@wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Sep 2, 2025

Details

Some tests rely on the TestUtils global object. Some import from the fake test-utils module. Both are unnecessary indirection when we can just import directly using a relative file path.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.
  • 💔 Yes, it does introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.
  • 🔬 Yes, it does include an observable change.

GUS work item

@wjhsf wjhsf requested a review from a team as a code owner September 2, 2025 20:01
DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER,
} from '../../helpers/options.js';

const UTILS = fileURLToPath(new URL('../../helpers/utils.js', import.meta.url));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only real change. Everything else is just changes to imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous PR was supposed to rename lwc.mjs to lwc.js; apparently lwc.js was added but this was not removed.

Copy link
Contributor

@rax-it rax-it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does all tests share this util or each gets it's individual copy at runtime?

@wjhsf
Copy link
Contributor Author

wjhsf commented Sep 2, 2025

Does all tests share this util or each gets it's individual copy at runtime?

Web Test Runner loads each .spec.js file as a separate page in the browser, and the util is just a generic JavaScript file. Tests on the same page will share an instance of the util, but tests on different pages won't.

@wjhsf wjhsf merged commit 50e4ca1 into master Sep 2, 2025
6 checks passed
@wjhsf wjhsf deleted the wjh/wtrrrr branch September 2, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants