Commit graph

7 commits

Author SHA1 Message Date
Anne Tomasevich
919c95782f CodexModule: Add exception if @wikimedia/codex is required
Bug: T356345
Change-Id: I656061bb0ef95b207241423a6d8c25a1448b6f24
2024-02-08 18:18:46 -05:00
Ty Hopp
751d8a0ff4 CodexModuleTest: Invalid codex components definition
This patch adds test cases for the following scenarios:

- codexComponents defined as an empty array in the module definition
  file
- codexComponents defined as a non-array type in the module definition
  file

Bug: T353858
Change-Id: I055f837baab2bfce5ae840a472a9f8a2bf3847df
2024-01-29 19:08:57 +00:00
Roan Kattouw
9024a8ee02 CodexModuleTest: Add test for exception when requesting chunks
CodexModule throws an InvalidArgumentException if one of the elements
of the codexComponents array refers to a private chunk rather than a
public entry point file. Add a unit test asserting this behavior.

Also add an `isset()` to the check in CodexModule so that it doesn't
cause a PHP notice about a missing array index.

Bug: T353191
Change-Id: I3e31511aeeb42d825c308f047894f5eba28b0f27
2024-01-25 14:31:33 -08:00
jenkins-bot
c3833b6681 Merge "CodexModule: Throw exception for non-entry points" 2024-01-17 18:56:18 +00:00
Anne Tomasevich
c8117c78ca CodexModule: Throw exception for non-entry points
If a generated chunk is listed in the codexComponents array,
an exception will be thrown informing the developer that the
item is not an export of Codex and cannot be required.

Text fixtures and expected values were updated to match
recent changes to the manifest that made composables
explict entries.

Bug: T353191
Change-Id: Ie3e35501993b1ad5d29ebecbcc8203e7f4ea8c81
2024-01-17 12:29:47 -05:00
Ty Hopp
6146b5ef98 CodexModuleTest: Missing codex components definition
This patch adds a test case for the scenario where a codex component is
not defined in the module definition file and a user attempts to require
it.

The scenario where the 'codexComponents' key is defined but is an empty
array will be tested separately after 984663 lands.

Bug: T353858
Change-Id: I717ac327848ff6f6baad83110e8d2f10c135e5f1
2024-01-17 13:11:48 +08:00
Anne Tomasevich
4baf4dd8be CodexModule: Add unit test for code splitting
This requires the path to the Codex modules directory
to be configurable, so we can use static manifest and
component files in tests. This is achieved by changing
the constant storing the Codex modules dir from private
to protected so it can be overridden when creating a
test module.

Bug: T350054
Change-Id: Icd3c6c5d2a82f5a5fb1c38b52e54893034e7375c
2023-12-01 00:52:23 +00:00