Comparing version 5.3.2 to 5.4.0
@@ -709,20 +709,31 @@ 'use strict'; | ||
if (!isRegExp(regexp)) { | ||
throw new TypeError('The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'); | ||
this._assert(false, { | ||
message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), | ||
operator: 'match', | ||
actual: objectToString(regexp), | ||
expected: '[object RegExp]', | ||
extra: extra | ||
}); | ||
} else if (typeof string !== 'string') { | ||
this._assert(false, { | ||
message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), | ||
operator: 'match', | ||
actual: string === null ? null : typeof string, | ||
expected: 'string', | ||
extra: extra | ||
}); | ||
} else { | ||
var matches = $test(regexp, string); | ||
var message = defined( | ||
msg, | ||
'The input ' + (matches ? 'matched' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) | ||
); | ||
this._assert(matches, { | ||
message: message, | ||
operator: 'match', | ||
actual: string, | ||
expected: regexp, | ||
extra: extra | ||
}); | ||
} | ||
if (typeof string !== 'string') { | ||
throw new TypeError('The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'); | ||
} | ||
var matches = $test(regexp, string); | ||
var message = defined( | ||
msg, | ||
'The input ' + (matches ? 'matched' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) | ||
); | ||
this._assert(matches, { | ||
message: message, | ||
operator: 'match', | ||
actual: string, | ||
expected: regexp, | ||
extra: extra | ||
}); | ||
}; | ||
@@ -732,19 +743,31 @@ | ||
if (!isRegExp(regexp)) { | ||
throw new TypeError('The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'); | ||
this._assert(false, { | ||
message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), | ||
operator: 'doesNotMatch', | ||
actual: objectToString(regexp), | ||
expected: '[object RegExp]', | ||
extra: extra | ||
}); | ||
} else if (typeof string !== 'string') { | ||
this._assert(false, { | ||
message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), | ||
operator: 'doesNotMatch', | ||
actual: string === null ? null : typeof string, | ||
expected: 'string', | ||
extra: extra | ||
}); | ||
} else { | ||
var matches = $test(regexp, string); | ||
var message = defined( | ||
msg, | ||
'The input ' + (matches ? 'was expected to not match' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) | ||
); | ||
this._assert(!matches, { | ||
message: message, | ||
operator: 'doesNotMatch', | ||
actual: string, | ||
expected: regexp, | ||
extra: extra | ||
}); | ||
} | ||
if (typeof string !== 'string') { | ||
throw new TypeError('The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'); | ||
} | ||
var matches = $test(regexp, string); | ||
var message = defined( | ||
msg, | ||
'The input ' + (matches ? 'was expected to not match' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) | ||
); | ||
this._assert(!matches, { | ||
message: message, | ||
operator: 'doesNotMatch', | ||
actual: string, | ||
expected: regexp, | ||
extra: extra | ||
}); | ||
}; | ||
@@ -751,0 +774,0 @@ |
{ | ||
"name": "tape", | ||
"version": "5.3.2", | ||
"version": "5.4.0", | ||
"description": "tap-producing test harness for node and browsers", | ||
@@ -36,7 +36,7 @@ "main": "index.js", | ||
"has": "^1.0.3", | ||
"has-dynamic-import": "^2.0.0", | ||
"has-dynamic-import": "^2.0.1", | ||
"inherits": "^2.0.4", | ||
"is-regex": "^1.1.4", | ||
"minimist": "^1.2.5", | ||
"object-inspect": "^1.11.0", | ||
"object-inspect": "^1.12.0", | ||
"object-is": "^1.1.5", | ||
@@ -50,3 +50,3 @@ "object.assign": "^4.1.2", | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^19.0.1", | ||
"@ljharb/eslint-config": "^20.1.0", | ||
"array.prototype.flatmap": "^1.2.5", | ||
@@ -58,3 +58,3 @@ "aud": "^1.1.5", | ||
"es-value-fixtures": "^1.2.1", | ||
"eslint": "^8.2.0", | ||
"eslint": "^8.5.0", | ||
"falafel": "^2.2.4", | ||
@@ -61,0 +61,0 @@ "js-yaml": "^3.14.0", |
@@ -17,7 +17,53 @@ 'use strict'; | ||
'# match', | ||
'ok 1 regex arg must be a regex', | ||
'ok 2 string arg must be a string', | ||
'not ok 3 The input did not match the regular expression /abc/. Input: \'string\'', | ||
'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', | ||
' ---', | ||
' operator: match', | ||
' expected: \'[object RegExp]\'', | ||
' actual: \'[object String]\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 2 regex arg must not be a string', | ||
' ---', | ||
' operator: match', | ||
' expected: \'[object RegExp]\'', | ||
' actual: \'[object String]\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: regex arg must not be a string', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', | ||
' ---', | ||
' operator: match', | ||
' expected: \'string\'', | ||
' actual: \'object\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 4 string arg must not be an object', | ||
' ---', | ||
' operator: match', | ||
' expected: \'string\'', | ||
' actual: \'object\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: string arg must not be an object', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 5 The input did not match the regular expression /abc/. Input: \'string\'', | ||
' ---', | ||
' operator: match', | ||
' expected: /abc/', | ||
@@ -32,3 +78,3 @@ ' actual: \'string\'', | ||
' ...', | ||
'not ok 4 "string" does not match /abc/', | ||
'not ok 6 "string" does not match /abc/', | ||
' ---', | ||
@@ -45,9 +91,9 @@ ' operator: match', | ||
' ...', | ||
'ok 5 The input matched the regular expression /pass$/. Input: \'I will pass\'', | ||
'ok 6 "I will pass" matches /pass$/', | ||
'ok 7 The input matched the regular expression /pass$/. Input: \'I will pass\'', | ||
'ok 8 "I will pass" matches /pass$/', | ||
'', | ||
'1..6', | ||
'# tests 6', | ||
'# pass 4', | ||
'# fail 2', | ||
'1..8', | ||
'# tests 8', | ||
'# pass 2', | ||
'# fail 6', | ||
'' | ||
@@ -60,15 +106,9 @@ ]); | ||
test('match', function (t) { | ||
t.plan(6); | ||
t.plan(8); | ||
t.throws( | ||
function () { t.match(/abc/, 'string'); }, | ||
TypeError, | ||
'regex arg must be a regex' | ||
); | ||
t.match(/abc/, 'string'); | ||
t.match(/abc/, 'string', 'regex arg must not be a string'); | ||
t.throws( | ||
function () { t.match({ abc: 123 }, /abc/); }, | ||
TypeError, | ||
'string arg must be a string' | ||
); | ||
t.match({ abc: 123 }, /abc/); | ||
t.match({ abc: 123 }, /abc/, 'string arg must not be an object'); | ||
@@ -93,7 +133,53 @@ t.match('string', /abc/); | ||
'# doesNotMatch', | ||
'ok 1 regex arg must be a regex', | ||
'ok 2 string arg must be a string', | ||
'not ok 3 The input was expected to not match the regular expression /string/. Input: \'string\'', | ||
'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', | ||
' ---', | ||
' operator: doesNotMatch', | ||
' expected: \'[object RegExp]\'', | ||
' actual: \'[object String]\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 2 regex arg must not be a string', | ||
' ---', | ||
' operator: doesNotMatch', | ||
' expected: \'[object RegExp]\'', | ||
' actual: \'[object String]\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: regex arg must not be a string', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', | ||
' ---', | ||
' operator: doesNotMatch', | ||
' expected: \'string\'', | ||
' actual: \'object\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 4 string arg must not be an object', | ||
' ---', | ||
' operator: doesNotMatch', | ||
' expected: \'string\'', | ||
' actual: \'object\'', | ||
' at: Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' stack: |-', | ||
' Error: string arg must not be an object', | ||
' [... stack stripped ...]', | ||
' at Test.<anonymous> ($TEST/match.js:$LINE:$COL)', | ||
' [... stack stripped ...]', | ||
' ...', | ||
'not ok 5 The input was expected to not match the regular expression /string/. Input: \'string\'', | ||
' ---', | ||
' operator: doesNotMatch', | ||
' expected: /string/', | ||
@@ -108,3 +194,3 @@ ' actual: \'string\'', | ||
' ...', | ||
'not ok 4 "string" should not match /string/', | ||
'not ok 6 "string" should not match /string/', | ||
' ---', | ||
@@ -121,3 +207,3 @@ ' operator: doesNotMatch', | ||
' ...', | ||
'not ok 5 The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', | ||
'not ok 7 The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', | ||
' ---', | ||
@@ -134,3 +220,3 @@ ' operator: doesNotMatch', | ||
' ...', | ||
'not ok 6 "I will pass" should not match /pass$/', | ||
'not ok 8 "I will pass" should not match /pass$/', | ||
' ---', | ||
@@ -147,7 +233,9 @@ ' operator: doesNotMatch', | ||
' ...', | ||
'ok 9 The input did not match the regular expression /pass$/. Input: \'I will fail\'', | ||
'ok 10 "I will fail" does not match /pass$/', | ||
'', | ||
'1..6', | ||
'# tests 6', | ||
'1..10', | ||
'# tests 10', | ||
'# pass 2', | ||
'# fail 4', | ||
'# fail 8', | ||
'' | ||
@@ -160,15 +248,9 @@ ]); | ||
test('doesNotMatch', function (t) { | ||
t.plan(6); | ||
t.plan(10); | ||
t.throws( | ||
function () { t.doesNotMatch(/abc/, 'string'); }, | ||
TypeError, | ||
'regex arg must be a regex' | ||
); | ||
t.doesNotMatch(/abc/, 'string'); | ||
t.doesNotMatch(/abc/, 'string', 'regex arg must not be a string'); | ||
t.throws( | ||
function () { t.doesNotMatch({ abc: 123 }, /abc/); }, | ||
TypeError, | ||
'string arg must be a string' | ||
); | ||
t.doesNotMatch({ abc: 123 }, /abc/); | ||
t.doesNotMatch({ abc: 123 }, /abc/, 'string arg must not be an object'); | ||
@@ -181,4 +263,7 @@ t.doesNotMatch('string', /string/); | ||
t.doesNotMatch('I will fail', /pass$/); | ||
t.doesNotMatch('I will fail', /pass$/, '"I will fail" does not match /pass$/'); | ||
t.end(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253975
6600
Updatedhas-dynamic-import@^2.0.1
Updatedobject-inspect@^1.12.0