firebase-functions-test icon indicating copy to clipboard operation
firebase-functions-test copied to clipboard

Running tests imports main from package and fails to exec

Open RohovDmytro opened this issue 1 year ago • 2 comments
trafficstars

Running test via jest executes main file from package.json. It's a react-native code in my setup and this messes things around.

image

RohovDmytro avatar Jan 13 '24 10:01 RohovDmytro

Workaround is to mock @app/index via jest.setup.js

const { jest } = require('@jest/globals');

jest.mock('@app/index.js', () => ({}));

RohovDmytro avatar Jan 13 '24 10:01 RohovDmytro

Note to mock before requiring firebase-functions-test

RohovDmytro avatar Jan 13 '24 10:01 RohovDmytro