Make label argument in emit optional

I've also added bunch of tests for the arguments. Javascript is so fun in these cases...