Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 committed Nov 26, 2024
1 parent 6942aa0 commit b339c9f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions test/storybook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,15 @@ describe('percy storybook', () => {

await expectAsync(storybook(['http://localhost:8000']))
// message contains the client stack trace
.toBeRejectedWithError(/^Story Error\n.*\/iframe\.html.*$/s);
.toBeRejectedWithError(/^\[percy\] Error: Snapshot Name:/s);

expect(logger.stderr).toEqual([
'[percy] Build not created',
// message contains the client stack trace
jasmine.stringMatching(/^\[percy\] Snapshot Name: .*\nError: Story Error\n.*\/iframe\.html.*$/s)
jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
)

]);
});

Expand Down Expand Up @@ -223,8 +226,9 @@ describe('percy storybook', () => {
expect(logger.stderr).toEqual([
'[percy] Failed to capture story: foo: bar',
// error logs contain the client stack trace
jasmine.stringMatching(/^\[percy\] Snapshot Name: .*\nError: Story Error\n.*\/iframe\.html.*$/s),

jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
),
// does not create a build if all stories failed [ 1 in this case ]
'[percy] Build not created'
]);
Expand Down Expand Up @@ -270,11 +274,13 @@ describe('percy storybook', () => {

// contains logs of story error
expect(logger.stderr).toEqual([
'[percy] Retrying Story: foo: bar',
'[percy] Retrying Story: foo: bar',
'[percy] Retrying Story: foo: bar, attempt: 1',
'[percy] Retrying Story: foo: bar, attempt: 2',
'[percy] Failed to capture story: foo: bar',
// error logs contain the client stack trace
jasmine.stringMatching(/^\[percy\] Snapshot Name: .*\nError: Story Error\n.*\/iframe\.html.*$/s),
jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
),

// does not create a build if all stories failed [ 1 in this case ]
'[percy] Build not created'
Expand Down

0 comments on commit b339c9f

Please sign in to comment.