livepeer / protocol

Livepeer protocol
MIT License
154 stars 45 forks source link

Using -g flag when running tests does not support multi-word strings #398

Closed yondonfu closed 2 years ago

yondonfu commented 4 years ago

When I run the command npm run test -- -g "transcoder is not already registered" test/unit/BondingManager.js I expect only the it/describe blocks containing "transcoder is not already registered" to run within test/unit/BondingManager.js. However, instead, all it/describe blocks containing "transcoder" are run. It looks like the Mocha RegExp is matching the "transcoder" pattern, but the rest of the string passed to the -g flag are dropped:

> bash scripts/test.sh "-g" "\"transcoder" "is" "not" "already" "registered\"" "test/unit/BondingManager.js"

Starting new ganache instance at port 8545
RegExp: 4: /"transcoder/

I suspect this is due to the use of "$@" in test.sh which I think strips user provided quotes. As a result, "transcoder is not already registered" would not be passed to the -g flag as a quoted string.