This in now possible. I finally find this clear medium post which explain how do it : https://medium.com/@moki298/test-your-firebase-cloud-functions-locally-using-cloud-functions-shell-32c821f8a5ce
To run a trigger locally, use the "functions shell" tool :
1 - My code for firestore (the medium post use RealTime Database) :
exports.testTrigger = functions.firestore
.document('messages/{messageId}')
.onCreate((snapshot, context) => {
let message = snapshot.data()
return snapshot.ref.set({
...message,
status : 'sent'
})
})
2 - I run the firebase shell functions in the terminal
firebase functions:shell
3 - I call my "testTrigger" cloud function trigger with data in parameter
testTrigger({text:"hello"})
4- My firestore database has a new "message" updated by my trigger