Search code examples
firebasefirebase-realtime-databasegoogle-cloud-functionsfirebase-cli

Is it possible to run a script from Firebase Functions Shell?


I've been using the Firebase Functions Shell (firebase experimental:functions:shell) and am finding it excellent for testing the firebase database and http listeners.

However it is a little annoying that I have to copy-paste test code in the shell.

Is there any way I can just write some js code in a file and then run the complete file with the Firebase shell? Without copying and pasting?


Solution

  • Yes, send your script the the shell's stdin.

    $ firebase experimental:functions:shell < tests.js
    

    Taken from this blog.

    You may still have to terminate the shell with ctl-C. Please file a bug report if you would like to see that change.