Skip to content

Commit ab622ec

Browse files
committed
fix(rstest): replace mockRequire to rstest_mock_require
1 parent d967d97 commit ab622ec

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

crates/rspack_plugin_rstest/src/parser_plugin.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,14 @@ impl RstestParserPlugin {
586586
}
587587
// rs.mockRequire
588588
("rs" | "rstest", "mockRequire") => {
589-
self.process_mock(parser, call_expr, true, false, MockMethod::Mock, true);
589+
self.process_mock(
590+
parser,
591+
call_expr,
592+
true,
593+
false,
594+
MockMethod::MockRequire,
595+
true,
596+
);
590597
Some(false)
591598
}
592599
// rs.doMock

tests/rspack-test/configCases/rstest/mock/rspack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ __webpack_require__.rstest_mock = (id, modFactory) => {
9999
}
100100
};
101101
102+
__webpack_require__.rstest_mock_require = __webpack_require__.rstest_mock;
103+
102104
__webpack_require__.rstest_do_mock = (id, modFactory) => {
103105
let requiredModule = undefined
104106
try {

0 commit comments

Comments
 (0)