From 831ed36c1cf7cfeeb76a52c99d3d60b6aa4290b2 Mon Sep 17 00:00:00 2001 From: Timeless0911 <1604889533@qq.com> Date: Wed, 16 Oct 2024 11:38:49 +0800 Subject: [PATCH 1/2] test: enable resolve false test --- .../resolve/__snapshots__/index.test.ts.snap | 61 +++++++++++++++++++ tests/integration/resolve/index.test.ts | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/integration/resolve/__snapshots__/index.test.ts.snap diff --git a/tests/integration/resolve/__snapshots__/index.test.ts.snap b/tests/integration/resolve/__snapshots__/index.test.ts.snap new file mode 100644 index 000000000..787a97832 --- /dev/null +++ b/tests/integration/resolve/__snapshots__/index.test.ts.snap @@ -0,0 +1,61 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`resolve false 1`] = ` +"var __webpack_modules__ = { + \\"?69d8\\": function() { + /* (ignored) */ } +}; +/************************************************************************/ // The module cache +var __webpack_module_cache__ = {}; +// The require function +function __webpack_require__(moduleId) { + // Check if module is in cache + var cachedModule = __webpack_module_cache__[moduleId]; + if (void 0 !== cachedModule) return cachedModule.exports; + // Create a new module (and put it into the cache) + var module = __webpack_module_cache__[moduleId] = { + exports: {} + }; + // Execute the module function + __webpack_modules__[moduleId](module, module.exports, __webpack_require__); + // Return the exports of the module + return module.exports; +} +/************************************************************************/ // webpack/runtime/compat_get_default_export +(()=>{ + // getDefaultExport function for compatibility with non-harmony modules + __webpack_require__.n = function(module) { + var getter = module && module.__esModule ? function() { + return module['default']; + } : function() { + return module; + }; + __webpack_require__.d(getter, { + a: getter + }); + return getter; + }; +})(); +// webpack/runtime/define_property_getters +(()=>{ + __webpack_require__.d = function(exports, definition) { + for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, { + enumerable: true, + get: definition[key] + }); + }; +})(); +// webpack/runtime/has_own_property +(()=>{ + __webpack_require__.o = function(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + }; +})(); /************************************************************************/ +const bar = 'bar'; +// EXTERNAL MODULE: ./browser-false/util (ignored) +var util_ignored_ = __webpack_require__(\\"?69d8\\"); +var util_ignored_default = /*#__PURE__*/ __webpack_require__.n(util_ignored_); +console.log('foo:', util_ignored_default()); // the value of \`foo\` should \`{}\` +console.log('bar: ', bar); +" +`; diff --git a/tests/integration/resolve/index.test.ts b/tests/integration/resolve/index.test.ts index 57213cd26..0ab5e24b9 100644 --- a/tests/integration/resolve/index.test.ts +++ b/tests/integration/resolve/index.test.ts @@ -16,7 +16,7 @@ test('resolve data url', async () => { // TODO: false module path is different from linux and windows // EXTERNAL MODULE: /rslib/e2e/cases/resolve/false/./browser-false/util (ignored) -test.todo('resolve false', async () => { +test('resolve false', async () => { const fixturePath = join(__dirname, 'false'); const { entries, isSuccess } = await buildAndGetResults({ fixturePath }); From 166792596391524ec69ca1384ec207d0efc5488f Mon Sep 17 00:00:00 2001 From: Timeless0911 <1604889533@qq.com> Date: Wed, 16 Oct 2024 11:48:42 +0800 Subject: [PATCH 2/2] chore: update --- tests/integration/resolve/index.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/integration/resolve/index.test.ts b/tests/integration/resolve/index.test.ts index 0ab5e24b9..355a363c6 100644 --- a/tests/integration/resolve/index.test.ts +++ b/tests/integration/resolve/index.test.ts @@ -14,8 +14,6 @@ test('resolve data url', async () => { `); }); -// TODO: false module path is different from linux and windows -// EXTERNAL MODULE: /rslib/e2e/cases/resolve/false/./browser-false/util (ignored) test('resolve false', async () => { const fixturePath = join(__dirname, 'false'); const { entries, isSuccess } = await buildAndGetResults({ fixturePath });