jest-plugin-must-assert
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "jest-plugin-must-assert", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Jest plugin for async tests", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jest", | ||
"harness": "node test-harness.js" | ||
"test": "jest" | ||
}, | ||
@@ -10,0 +9,0 @@ "engines": { |
@@ -81,10 +81,8 @@ # `jest-plugin-must-assert` | ||
* Options: | ||
* @param {Number} originTestId The unique ID of the test where the task is oginating from | ||
* @param {Number} currentTestId The unique ID of the currently executing test | ||
* @param {String} testName The name of the test which triggered this event | ||
* @param {Object} task The task which is about to be invoked | ||
* @param {String} task.type The type of task being invoked (micro/macro task) | ||
* @param {String} task.source The source of the taks ("promise.then", "setTimeout" etc) | ||
* @param {Object} logger The logger object (defaults to console) | ||
* @param {Function} getStackTrace Returns the stack-trace of the stack | ||
* @param {Number} originTestId The unique ID of the test where the task is oginating from | ||
* @param {Number} currentTestId The unique ID of the currently executing test | ||
* @param {String} testName The name of the test which triggered this event | ||
* @param {String} taskType The type of task being invoked (micro/macro task) | ||
* @param {String} taskSource The source of the taks ("promise.then", "setTimeout" etc) | ||
* @param {Object} logger The logger object (defaults to console) | ||
* | ||
@@ -91,0 +89,0 @@ * @throws {Error} Default: throws. This function _may_ throw an error instead of logging it if |
@@ -25,5 +25,5 @@ /** | ||
// The type of the task being acted upon [micro || macro]Task | ||
task, | ||
// Get the stack trace associated wit the task | ||
getStackTrace, | ||
taskType, | ||
// Promise, setTimeout etc. | ||
taskSource, | ||
}) { | ||
@@ -33,6 +33,5 @@ // Note that we do not use "testName" for this as they are not guaranteed to be | ||
if (originZoneId !== currentZoneId) { | ||
const error = new Error( | ||
`Test "${testName}" is attempting to invoke a ${task.type}(${task.source}) after test completion. See stack-trace for details.` | ||
throw new Error( | ||
`Test "${testName}" is attempting to invoke a ${taskType}(${taskSource}) after test completion. See stack-trace for details.` | ||
); | ||
throw error; | ||
} | ||
@@ -39,0 +38,0 @@ return true; |
@@ -85,21 +85,2 @@ /** | ||
let result = true; | ||
// Exposes the stack trace associated with the task | ||
function getStackTrace() { | ||
let stack; | ||
try { | ||
throw new Error(); | ||
} catch (e) { | ||
e.task = task; | ||
Zone.longStackTraceZoneSpec.onHandleError( | ||
delegate, | ||
current, | ||
target, | ||
e | ||
); | ||
stack = e.stack; | ||
} | ||
return stack; | ||
} | ||
try { | ||
@@ -110,5 +91,5 @@ result = onInvokeTask({ | ||
testName: name, | ||
task, | ||
taskType: task.type, | ||
taskSource: task.source, | ||
logger: logger, | ||
getStackTrace, | ||
}); | ||
@@ -115,0 +96,0 @@ } catch (e) { |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
const runCLI = require('jest').runCLI; | ||
const runCLI = require('jest-cli').runCLI; | ||
@@ -8,0 +8,0 @@ const [env = 'node'] = process.argv.slice(2); |
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
26326
677
138