From e5c217b45a65bc5735e7cf325438d8564b38808b Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Sat, 3 Oct 2020 18:11:09 +0900 Subject: [PATCH 1/2] pass reject to testMethod --- .../storyshots-core/src/api/snapshotsTestsTemplate.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts b/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts index a2564022f4e6..159dcd5cd3eb 100644 --- a/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts +++ b/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts @@ -11,9 +11,10 @@ function snapshotTest({ item, asyncJest, framework, testMethod, testMethodParams it( name, () => - new Promise((done) => + new Promise((done, reject) => testMethod({ done, + reject, story: item, context, ...testMethodParams, From 380726e5d8ce66103aeeaacf825d5144a911e35a Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Sun, 4 Oct 2020 01:20:55 +0900 Subject: [PATCH 2/2] improve done function --- .../storyshots-core/src/api/snapshotsTestsTemplate.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts b/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts index 159dcd5cd3eb..deef13602eb8 100644 --- a/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts +++ b/addons/storyshots/storyshots-core/src/api/snapshotsTestsTemplate.ts @@ -11,10 +11,9 @@ function snapshotTest({ item, asyncJest, framework, testMethod, testMethodParams it( name, () => - new Promise((done, reject) => + new Promise((resolve, reject) => testMethod({ - done, - reject, + done: (error: any) => (error ? reject(error) : resolve()), story: item, context, ...testMethodParams,