-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
- I'd be willing to implement a fix
Describe the bug
When using a simple Jest test that does a require('pnpapi'), it gets this 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.
To Reproduce
- yarn dlx create-react-app my-app
- cd my-app/src
- Create this test case, in pnpapi.test.js
describe('Pipapi test', () => {
test('pnpali', async () => {
const pnpapi = require('pnpapi');
pnpapi.findPackageLocator();
});
});
- cd ..
- yarn react-scripts test src/pnpapi.test.js
- You will see output similar to this:
FAIL src/pnpapi.test.js
Pipapi test
✕ pnpali (290ms)
● Pipapi test › pnpali
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> (src/pnpapi.test.js:4:20)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.532s, estimated 3s
Environment if relevant (please complete the following information):
- OS: [OSX 10.15.6]
- Node version [12.16.2]
- Yarn version [2.3.3]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working