When using ES6 import / export syntax, it seems that Jest automatically imports the components that I import by default, even if I explicitly disconnected for the component.
jest.autoMockOff();
jest.dontMock("../bundles/Opportunities/MarkAsLost.jsx");
this is the import at the top of the test component:
import MarkAsLost from "../bundles/Opportunities/MarkAsLost.jsx";
this is the export at the bottom of the test component:
export default MarkAsLost;
this is the result of registering the imported component in a test file:
{ [Function]
_isMockFunction: true,
_getMockImplementation: [Function],
mock: { calls: [ [Object] ], instances: [ [Object] ] },
mockClear: [Function],
mockReturnValueOnce: [Function],
mockReturnValue: [Function],
mockImpl: [Function],
mockImplementation: [Function],
mockReturnThis: [Function],
displayName: 'MarkAsLost' }
when i use ie old style syntax:
var MarkAsLost = require("../bundles/Opportunities/MarkAsLost.jsx");
module.exports = MarkAsLost;
this is the result of the loggin component, which now behaves the way I want in the test file
{ [Function] displayName: 'MarkAsLost' }
Any help would be appreciated