@pmoo/testy
Advanced tools
Comparing version 7.0.1 to 7.0.2
@@ -28,5 +28,6 @@ 'use strict'; | ||
async run(context) { | ||
const state = { isRunning: true }; | ||
await Promise.race([ | ||
this.#timeoutThreshold(context.testExecutionTimeoutMs), | ||
TestResult.evaluate(this, context), | ||
this.#timeoutThreshold(context.testExecutionTimeoutMs, state), | ||
TestResult.evaluate(this, context).then(_result => state.isRunning = false), | ||
]); | ||
@@ -154,7 +155,9 @@ } | ||
#timeoutThreshold(timeoutMs) { | ||
#timeoutThreshold(timeoutMs, state) { | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
this.setResult(TestResult.error(I18nMessage.of('reached_timeout_error', timeoutMs))); | ||
this.finishWithError(); | ||
if (state.isRunning) { | ||
this.setResult(TestResult.error(I18nMessage.of('reached_timeout_error', timeoutMs))); | ||
this.finishWithError(); | ||
} | ||
// This is resolve() and not reject() because we want other tests to be executed. | ||
@@ -161,0 +164,0 @@ // There was an error in terms of the test itself, but there was not an error in terms of Testy's execution. |
{ | ||
"name": "@pmoo/testy", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "A minimal testing framework, for educational purposes.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://ngarbezza.github.io/testy/", |
@@ -275,2 +275,3 @@ # Testy | ||
<td align="center"><a href="https://github.com/ignacio-r"><img src="https://avatars.githubusercontent.com/u/42122391?v=4" width="100px;" alt=""/><br /><sub><b>Ignacio Robledo</b></sub></a><br /><a href="https://github.com/ngarbezza/testy/commits?author=ignacio-r" title="Code">💻</a> <a href="https://github.com/ngarbezza/testy/commits?author=ignacio-r" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/mellster2012"><img src="https://avatars.githubusercontent.com/u/2126256?v=4" width="100px;" alt=""/><br /><sub><b>Marco Ellwanger</b></sub></a><br /><a href="https://github.com/ngarbezza/testy/commits?author=mellster2012" title="Code">💻</a> <a href="https://github.com/ngarbezza/testy/commits?author=mellster2012" title="Tests">⚠️</a></td> | ||
</tr> | ||
@@ -277,0 +278,0 @@ </table> |
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
109961
2619
285