Skip to content

Instantly share code, notes, and snippets.

@eschwartz
Last active March 7, 2017 16:44
Show Gist options
  • Save eschwartz/c6e4390982f1bc4744e46408279e80ce to your computer and use it in GitHub Desktop.
Save eschwartz/c6e4390982f1bc4744e46408279e80ce to your computer and use it in GitHub Desktop.
function assertMatch(actual:string, regex: string | RegExp, msg?:string):void {
const regexNorml:RegExp = _.isString(regex) ? new RegExp(regex as string) : regex;
const isMatch = regexNorml.test(actual);
if (!isMatch) {
assert.fail(actual, regexNorml.toString(), msg, 'matches');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment