Improve errors with the domaine and how to use the API
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
getJasmineRequireObj().toMatch = function(j$) {
|
||||
|
||||
var getErrorMsg = j$.formatErrorMsg('<toMatch>', 'expect(<expectation>).toMatch(<string> || <regexp>)');
|
||||
|
||||
function toMatch() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
||||
throw new Error('Expected is not a String or a RegExp');
|
||||
throw new Error(getErrorMsg('Expected is not a String or a RegExp'));
|
||||
}
|
||||
|
||||
var regexp = new RegExp(expected);
|
||||
|
||||
Reference in New Issue
Block a user