-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Hello,
When I try to test a mapbox componet with jest, I get the error Error in mounted hook: "ReferenceError: mapboxgl is not defined"
I've tried changing my jest config to
module.exports = {
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/.jest/fileMock.js',
mapboxgl: '<rootDir>/node_modules/mapbox-gl/dist/mapbox-gl.js',
},
};and even adding a jest mock but I can't get it to work
jest.mock('mapboxgl', () => ({
Map: () => ({}),
}));Metadata
Metadata
Assignees
Labels
No labels