You can use the firestore-backup-restore to export and import your production data as JSON files.
I wrote a quick hack to allow for importing these JSON in the Firebase Simulator Firestore instance.
I proposed a pull request and made this npm module in the meantime.
You can use it this way:
const firestoreService = require('@crapougnax/firestore-export-import') const path = require('path') // list of JSON files generated with the export service // Must be in the same folder as this script const collections = ['languages', 'roles'] // Start your firestore emulator for (at least) firestore // firebase emulators:start --only firestore // Initiate Firebase Test App const db = firestoreService.initializeTestApp('test', { uid: 'john', email: '[email protected]', }) // Start importing your data let promises = [] try { collections.map(collection => promises.push( firestoreService.fixtures( path.resolve(__dirname, `./${collection}.json`), [], [], db, ), ), ) Promise.all(promises).then(process.exit) } catch (err) { console.error(err) } Obviously, since this data won't persist in the emulator, you'll typically inject them in the before() function of your test suite or even before every test.
Hope this helps.