Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Feb 8, 2021
1 parent 9911e6b commit e54168f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions test/TestCases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,16 @@ describe('TestCases', () => {
);
} else {
const matchAll = res.match(
/__webpack_require__\.h = \(\) => "([\d\w].*)"/i
/__webpack_require__\.h = \(\) => \(("[\d\w].*")\)/i
);

const replacer = new Array(matchAll[1].length);

res = res.replace(
/__webpack_require__\.h = \(\) => "([\d\w].*)"/i,
`__webpack_require__.h = () => "${replacer.fill('x').join('')}"`
/__webpack_require__\.h = \(\) => \(("[\d\w].*")\)/i,
`__webpack_require__.h = () => ("${replacer
.fill('x')
.join('')}")`
);
}

Expand Down
8 changes: 4 additions & 4 deletions test/cases/hmr/expected/webpack-5/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ module.exports = function (urlString) {
/******/
/******/ /* webpack/runtime/get update manifest filename */
/******/ (() => {
/******/ __webpack_require__.hmrF = () => "main." + __webpack_require__.h() + ".hot-update.json";
/******/ __webpack_require__.hmrF = () => ("main." + __webpack_require__.h() + ".hot-update.json");
/******/ })();
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ (() => {
/******/ __webpack_require__.h = () => "xxxxxxxxxxxxxxxxxxxx"
/******/ __webpack_require__.h = () => ("xxxxxxxxxxxxxxxxxxxxxx")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
Expand All @@ -386,7 +386,7 @@ module.exports = function (urlString) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
Expand Down Expand Up @@ -424,7 +424,7 @@ module.exports = function (urlString) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
/******/ doneFns && doneFns.forEach((fn) => fn(event));
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
/******/ ;
Expand Down

0 comments on commit e54168f

Please sign in to comment.