Comparing version 4.14.0 to 4.15.0
@@ -58,3 +58,4 @@ 'use strict'; | ||
var harness = createHarness({ | ||
autoclose: defined(config.autoclose, false) | ||
autoclose: defined(config.autoclose, false), | ||
noOnly: defined(conf.noOnly, defined(process.env.NODE_TAPE_NO_ONLY_TEST, false)) | ||
}); | ||
@@ -143,2 +144,3 @@ | ||
if (only) { throw new Error('there can only be one only test'); } | ||
if (conf_.noOnly) { throw new Error('`only` tests are prohibited'); } | ||
only = true; | ||
@@ -145,0 +147,0 @@ var t = test.apply(null, arguments); |
@@ -17,2 +17,3 @@ 'use strict'; | ||
var $test = callBound('RegExp.prototype.test'); | ||
var objectToString = callBound('Object.prototype.toString'); | ||
@@ -556,3 +557,3 @@ module.exports = Test; | ||
if (isRegExp(expected)) { | ||
passed = expected.test(caught && caught.error); | ||
passed = $test(expected, caught && caught.error); | ||
expected = String(expected); | ||
@@ -598,20 +599,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: '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 | ||
}); | ||
}; | ||
@@ -621,19 +633,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 | ||
}); | ||
}; | ||
@@ -640,0 +664,0 @@ |
{ | ||
"name": "tape", | ||
"version": "4.14.0", | ||
"version": "4.15.0", | ||
"description": "tap-producing test harness for node and browsers", | ||
"main": "index.js", | ||
"browser": { | ||
"fs": false | ||
}, | ||
"bin": "./bin/tape", | ||
@@ -17,17 +20,17 @@ "directories": { | ||
"for-each": "~0.3.3", | ||
"glob": "~7.1.7", | ||
"glob": "~7.2.0", | ||
"has": "~1.0.3", | ||
"inherits": "~2.0.4", | ||
"is-regex": "~1.1.3", | ||
"is-regex": "~1.1.4", | ||
"minimist": "~1.2.5", | ||
"object-inspect": "~1.11.0", | ||
"resolve": "~1.20.0", | ||
"object-inspect": "~1.12.0", | ||
"resolve": "~1.22.0", | ||
"resumer": "~0.0.0", | ||
"string.prototype.trim": "~1.2.4", | ||
"string.prototype.trim": "~1.2.5", | ||
"through": "~2.3.8" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^17.6.0", | ||
"array.prototype.flatmap": "^1.2.4", | ||
"aud": "^1.1.5", | ||
"@ljharb/eslint-config": "^20.2.0", | ||
"array.prototype.flatmap": "^1.2.5", | ||
"aud": "^2.0.0", | ||
"concat-stream": "^1.6.2", | ||
@@ -37,6 +40,6 @@ "eclint": "^2.8.1", | ||
"es-value-fixtures": "^1.2.1", | ||
"eslint": "^7.31.0", | ||
"eslint": "^8.7.0", | ||
"falafel": "^2.2.4", | ||
"js-yaml": "^3.14.0", | ||
"safe-publish-latest": "^1.1.4", | ||
"safe-publish-latest": "^2.0.0", | ||
"tap": "^8.0.1", | ||
@@ -48,4 +51,4 @@ "tap-parser": "^3.0.5" | ||
"prepublish": "!(type not-in-publish) || not-in-publish || npm run prepublishOnly", | ||
"prelint": "eclint check", | ||
"lint": "eslint . bin/*", | ||
"prelint": "eclint check $(git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js')", | ||
"lint": "eslint --ext .js,.cjs,.mjs . bin/*", | ||
"pretest": "npm run lint", | ||
@@ -52,0 +55,0 @@ "test": "npm run tests-only", |
@@ -48,3 +48,3 @@ 'use strict'; | ||
var stripped = ' [... stack stripped ...]'; | ||
var withDuplicates = output.split('\n').map(stripChangingData).map(function (line) { | ||
var withDuplicates = output.split(/\r?\n/g).map(stripChangingData).map(function (line) { | ||
var m = line.match(/[ ]{8}at .*\((.*)\)/); | ||
@@ -77,5 +77,5 @@ | ||
// Handle stack trace variation in Node v0.8 | ||
/(\[\.\.\. stack stripped \.\.\.\]\n *at) <anonymous> \(([^)]+)\)/g, | ||
/(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) <anonymous> \(([^)]+)\)/g, | ||
'$1 $2' | ||
).split('\n'); | ||
).split(/\r?\n/g); | ||
}; |
@@ -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(); | ||
}); | ||
}); |
@@ -172,3 +172,3 @@ 'use strict'; | ||
' actual: |-', | ||
" { [RangeError: actual!] message: 'actual!' }", | ||
' { [RangeError: actual!] ' + ('cause' in Error.prototype ? '[cause]: undefined, ' : '') + "message: 'actual!' }", | ||
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)', | ||
@@ -175,0 +175,0 @@ ' stack: |-', |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
216502
116
5540
574
7
21
+ Addedglob@7.2.3(transitive)
+ Addedobject-inspect@1.12.3(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedglob@7.1.7(transitive)
- Removedobject-inspect@1.11.1(transitive)
- Removedresolve@1.20.0(transitive)
Updatedglob@~7.2.0
Updatedis-regex@~1.1.4
Updatedobject-inspect@~1.12.0
Updatedresolve@~1.22.0
Updatedstring.prototype.trim@~1.2.5