Closed as not planned
Description
Version
29.4.3
Steps to reproduce
Create any component and add the import "server-only"
(https://www.npmjs.com/package/server-only) to mark it as server only code.
Try to run any test against it and they are going to fail and log the following message:
This module cannot be imported from a Client Component module. It should only be used from a Server Component.
Expected behavior
The test(s) should be able to run without any issues.
Actual behavior
Test fail and log
This module cannot be imported from a Client Component module. It should only be used from a Server Component.
Additional context
I've already tried the following:
- New project on jest.config with
testEnvironment: 'node'
- Environment comment on test file
/**
* @jest-environment node
*/
Environment
System:
OS: macOS 12.5.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
npmPackages:
jest: ^29.4.3 => 29.4.3