Skip to content

Commit

Permalink
remove memory leak from test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 7, 2021
1 parent 8784674 commit 92ffd07
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions test/cases/context/issue-10969/index.js
@@ -1,21 +1,12 @@
expect.extend({
toBeValidModuleId(received, moduleIdString) {
const pass = typeof received === "number" || received === moduleIdString;
if (pass) {
return {
message: () => `expected ${received} not to be a valid module id`,
pass: true
};
} else {
return {
message: () => `expected ${received} to be a valid module id`,
pass: false
};
}
}
});

it("should replace ! with %21 in the module id string of the context module", function () {
const moduleId = require.context("./folder", true, /^(?!file1\.js$).*$/i, "lazy").id;
expect(moduleId).toBeValidModuleId("./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/");
const moduleId = require.context(
"./folder",
true,
/^(?!file1\.js$).*$/i,
"lazy"
).id;
if (typeof moduleId !== "number")
expect(moduleId).toBe(
"./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/"
);
});

0 comments on commit 92ffd07

Please sign in to comment.