When mutating a module object, why are curly brace imports not changed?
问题 I'm playing around with tidying up a code base that does some direct module mutations, rather than using any mocking behaviour, and I've noticed something odd. If I, starting with a fresh create-react-app do something like this in a test: import React from 'react'; import { render } from '@testing-library/react'; import App from './App'; import lodash from "lodash"; test('renders learn react link', () => { // Directly mutating the module React.useContext = jest.fn(); React.foo = "foo"; lodash