question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test fails using yarn@berry and pnp-webpack-plugin

See original GitHub issue

🐛 Bug Report

Testing webpack build with babel-jest fails using yarn@berry and pnp-webpack-plugin.

test.js

const webpack = require('webpack');

test('simple', () => {
    expect(
        webpack({
            resolve: {
                plugins: [require('pnp-webpack-plugin')],
            },
        })
    ).not.toThrow();
});

output

    The whole PnP file got strict-mode-ified, which is known to break (Emscripten libraries aren't strict mode). This usually happens when the file goes through Babel.

       5 |   Object.freeze({}).detectStrictMode = true;
       6 | } catch (error) {
    >  7 |   throw new Error(`The whole PnP file got strict-mode-ified, which is known to break (Emscripten libraries aren't strict mode). This usually happens when the file goes through Babel.`);
         |         ^
       8 | }
       9 |
      10 | var __non_webpack_module__ = module;

      at Object.<anonymous> (.pnp.js:7:9)
      at Object.<anonymous> (index.test.js:7:27)

To Reproduce

https://github.com/irudoy/yarn-berry-webpack-jest-repro

Expected behavior

The test is successfully passed.

Link to repl or repo (highly encouraged)

https://github.com/irudoy/yarn-berry-webpack-jest-repro

envinfo

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 14.2.0 - /usr/local/bin/node
    Yarn: 2.0.0-rc.33 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
arcaniscommented, Aug 7, 2020

Can’t check right now, but I suspect babel-jest is transpiling the .pnp.js file, which it shouldn’t do for the reason described in the error message. I’d suggest to try disabling transforms on this file.

0reactions
github-actions[bot]commented, May 11, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plug'n'Play | Yarn - Package Manager
An overview of Plug'n'Play, a powerful and innovative installation strategy for Node.
Read more >
Yarn pnp causes drive letter mismatch on Windows with ...
Testcafe is unable to compile my test with yarn pnp, I run into the following error after switching to yarn pnp by setting...
Read more >
Yarn 2 and TypeScript: Adding Webpack - Medium
A screenshot representing a failed module request in Yarn Modern comiled ... If you'd like to see the entire workflow, check out my...
Read more >
How to use the pnp-webpack-plugin.forkTsCheckerOptions ...
To help you get started, we've selected a few pnp-webpack-plugin.forkTsCheckerOptions examples, based on popular ways it is used in public projects.
Read more >
Can't run Storybook with Webpack@5 #15252 - Issuehunt
Error : Cannot find module 'webpack/lib/util/makeSerializable.js' Require stack: ... /Users/saharb/dev/storybook-test/node_modules/@storybook/react-docgen- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found