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

Allow the option to specify render_entry_point() to be a no-op for backend tests #25

Open
shangxiao opened this issue May 1, 2023 · 3 comments

Comments

@shangxiao
Copy link
Contributor

render_entry_point() requires a stats file to be present, which may not be the case for various reasons

@davecoates
Copy link
Contributor

Does this need to be an option? Is mocking too onerous? e.g.

    def setUp(self):
        self.patcher = patch("allianceutils.webpack.WebpackEntryPointLoader.get_chunks_for_entry_point")
        self.mocked_render_entry_point = self.patcher.start()

    def tearDown(self):
        self.patcher.stop()

@shangxiao
Copy link
Contributor Author

The best workaround I found was to add a fake stats file:

{
  "status": "done",
  "entrypoints": {
    "<entry-point-name>": [{"name": "<entry-point-name>"}]
  },
  "publicPath": "http://127.0.0.1/"
}

place it in the frontend/ directory then add this to CI settings:

WEBPACK_LOADER["DEFAULT"]["STATS_FILE"] = PROJECT_DIR / "frontend/webpack-stats-ci.json"

An option to disable is the best DX though. Mocking is the least developer-friendly option.

@davecoates
Copy link
Contributor

This has never come up because builds are always committed, so the stats file used in production is available in CI. Do you not commit builds?

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

No branches or pull requests

2 participants