firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

firebase emulators:exec should pass down the arguments from command line

Open skhaz opened this issue 5 years ago • 1 comments

firebase emulators:exec should pass down the arguments from command line. For example

"scripts": {
  "test":  "firebase emulators:exec --only firestore --project sample 'jest --runInBand'",
}

If I run

npm run test -- foobar

firebase emulators:exec should take the extra argument (-- foobar) and pass down to jest, like this

firebase emulators:exec --only firestore --project sample 'jest --runInBand -- foobar'

skhaz avatar Jan 30 '21 12:01 skhaz

You can still achieve this even if the support is not native. Add a custom ./test.sh bash script with this content

./node_modules/.bin/firebase emulators:exec --project lol "vitest run $*"

and add this script to the package.json

"test": "./test.sh"

Now you can invoke it like this: pnpm run test --runInBand ./src/my1.test.ts ./src/my2.test.ts

(we are using vitest and pnpm, but it will work the same with other test runners and package managers).

fox1t avatar Jul 05 '22 13:07 fox1t

Closing this issue since I am not using Firebase anymore

skhaz avatar Aug 18 '22 16:08 skhaz