Skip to content

Commit

Permalink
fix(compartment-mapper): Qualify dynamic import test failure cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Nov 26, 2024
1 parent e56cc04 commit f470696
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/compartment-mapper/test/optional.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const fixtureOptionalDepsCjs = new URL(

scaffold(
'optionalDependencies/esm',
// this test fails because it relies on dynamic import
// fails for archives because dynamic import cannot reach modules not
// discovered during archival
test,
fixtureOptionalDepsEsm,
async (t, { namespace }) => {
Expand All @@ -41,7 +42,7 @@ scaffold(
);
},
4,
{ knownFailure: true },
{ knownArchiveFailure: true },
);

scaffold(
Expand Down
6 changes: 5 additions & 1 deletion packages/compartment-mapper/test/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function scaffold(
addGlobals = {},
policy,
knownFailure = false,
knownArchiveFailure = false,
tags = undefined,
conditions = tags,
strict = false,
Expand All @@ -111,7 +112,10 @@ export function scaffold(
// wrapping each time allows for convenient use of test.only
const wrap = (testFunc, testCategoryHint) => (title, implementation) => {
// mark as known failure if available (but fallback to support test.only)
if (knownFailure) {
if (
knownFailure ||
(knownArchiveFailure && testCategoryHint === 'Archive')
) {
testFunc = testFunc.failing || testFunc;
}
return testFunc(title, async t => {
Expand Down

0 comments on commit f470696

Please sign in to comment.