(test)
| 3606 | |
| 3607 | // Release a processing hold, scheduling a resumption attempt if no holds remain. |
| 3608 | function internalStart(test) { |
| 3609 | |
| 3610 | // If semaphore is non-numeric, throw error |
| 3611 | if (isNaN(test.semaphore)) { |
| 3612 | test.semaphore = 0; |
| 3613 | |
| 3614 | pushFailure("Invalid value on test.semaphore", sourceFromStacktrace(2)); |
| 3615 | return; |
| 3616 | } |
| 3617 | |
| 3618 | // Don't start until equal number of stop-calls |
| 3619 | if (test.semaphore > 0) { |
| 3620 | return; |
| 3621 | } |
| 3622 | |
| 3623 | // Throw an Error if start is called more often than stop |
| 3624 | if (test.semaphore < 0) { |
| 3625 | test.semaphore = 0; |
| 3626 | |
| 3627 | pushFailure("Tried to restart test while already started (test's semaphore was 0 already)", sourceFromStacktrace(2)); |
| 3628 | return; |
| 3629 | } |
| 3630 | |
| 3631 | // Add a slight delay to allow more assertions etc. |
| 3632 | if (defined.setTimeout) { |
| 3633 | if (config.timeout) { |
| 3634 | clearTimeout(config.timeout); |
| 3635 | } |
| 3636 | config.timeout = setTimeout$1(function () { |
| 3637 | if (test.semaphore > 0) { |
| 3638 | return; |
| 3639 | } |
| 3640 | |
| 3641 | if (config.timeout) { |
| 3642 | clearTimeout(config.timeout); |
| 3643 | } |
| 3644 | |
| 3645 | begin(); |
| 3646 | }); |
| 3647 | } else { |
| 3648 | begin(); |
| 3649 | } |
| 3650 | } |
| 3651 | |
| 3652 | function collectTests(module) { |
| 3653 | var tests = [].concat(module.tests); |
no test coverage detected