Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webpack] Migrate most js tests #35623

Merged
merged 19 commits into from
Jan 15, 2025
Merged

[webpack] Migrate most js tests #35623

merged 19 commits into from
Jan 15, 2025

Conversation

orangejenny
Copy link
Contributor

@orangejenny orangejenny commented Jan 15, 2025

Technical Summary

This makes some updates to js testing infrastructure to support js tests that use webpack, and it migrates js tests except for reports and cloudcare.

I'm waiting on migrating reports & userreports tests until #35599 is live, just in case that one needs to be rolled back.

For cloudcare tests, I'll either incorporate them into #35594 or do them after that PR is released.

https://dimagi.atlassian.net/browse/SAAS-15985

Safety Assurance

Safety story

Primarily affects tests. There is one non-tests change (1f43a0f). I've verified that translations still show up on webpack pages.

Automated test coverage

yep

QA Plan

nope

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

Notably, in requirejs, tests do not include "base_main" js,
which includes a bunch of global UI-oriented code: analytics,
modals for accounting and for inactivity, etc. In webpack, these
are part of the "commcarehq" bundle, which can end up in the dependency
tree for tests - as an example, for hqwebapp, hqwebapps/js/widgets is a
dependency of tests, and it includes commcarehq. To deal with this, I'm
updating this template to not error out on this UI code. This is why the language script
is moved up (by moving it above webpack.html, it's now available to all of the
js in tests), and why the commcarehq-urls block is added (without this,
notifications_service, which is part of base_main, errors out because it depends
on querying the notifications url).
This is necessary because the mocha app itself doesn't have any templates that use webpack. It just has
mocha/base.html, which is only used as a parent for templates in other apps.
…p-module-source-map

This is necessary to get proper line numbers to show up in mocha stack traces.
Mocha templates are part of the django app they test, but they inherit from base.html
in the mocha django app, and they use B3 unless they'rr part of a split app that has
both B3 and B5 tests. See https://github.com/dimagi/commcare-hq/blob/98629eaea9bb2cd9984fc374eb25d3dd3a37d87a/corehq/apps/mocha/views.py#L13-L21
@orangejenny orangejenny changed the title [webpack] Tests, starting with locations [webpack] Migrate tests, starting with locations Jan 15, 2025
@orangejenny orangejenny added the product/invisible Change has no end-user visible impact label Jan 15, 2025
@orangejenny orangejenny force-pushed the jls/mocha-experimental branch 4 times, most recently from b0606df to 597d81d Compare January 15, 2025 17:06
@orangejenny orangejenny force-pushed the jls/mocha-experimental branch from 597d81d to 4a79d7e Compare January 15, 2025 17:25
@orangejenny orangejenny changed the title [webpack] Migrate tests, starting with locations [webpack] Migrate most js tests Jan 15, 2025
orangejenny and others added 2 commits January 15, 2025 14:44
'yarn build' no longer includes dev dependencies, but 'yarn dev' uses the --watch flag so it never returns.
@orangejenny orangejenny requested a review from a team as a code owner January 15, 2025 19:52
@dimagimon dimagimon added the dependencies Pull requests that update a dependency file label Jan 15, 2025
@orangejenny orangejenny merged commit 359f5cb into master Jan 15, 2025
13 checks passed
@orangejenny orangejenny deleted the jls/mocha-experimental branch January 15, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file product/invisible Change has no end-user visible impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants