Skip to content

Commit

Permalink
🐛 fix: does'nt works spec.after which using spec.only.
Browse files Browse the repository at this point in the history
  • Loading branch information
59naga committed Aug 16, 2018
1 parent 4ed8ae3 commit 8a85d55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import chalk from 'chalk';

// private

let specOnly = false;
let specCount = 0;
let specOnly = false;
let specOnlyCount = 0;
let specSuccess = 0;
let specFailure = 0;
let specHookFailure = 0;
Expand Down Expand Up @@ -66,7 +67,10 @@ async function run(title, fn, opts = {}) {
}

// FIX: #1
if (specCount === specSuccess + specFailure) {
const isDone =
specCount === specSuccess + specFailure ||
specOnlyCount === specSuccess + specFailure;
if (isDone) {
try {
await Promise.all(specHooks.after.map(hook => hook()));
} catch (error) {
Expand Down Expand Up @@ -125,6 +129,7 @@ spec.skip = title => {
spec.only = (...args) => {
specCount++;
specOnly = true;
specOnlyCount++;

setImmediate(() => {
run(...args);
Expand Down

0 comments on commit 8a85d55

Please sign in to comment.