The problem is the error reporting. If i pass 'junk' the formatted error reports
Expected undefined, actual "junk"
Expected undefined, actual "junk"
which is obviously wrong. It seems the individual components of a union are reported in isolation. How can I change the error handling to be something like