Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always send output to flake callback #98

Merged
merged 2 commits into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function flake (options: object | undefined = {}, callback: Function | undefined

function handleTestEnd (status: number, output = '') {
if (status === 0) {
callback(status)
callback(status, output)
} else {
if (++testAttempt <= parsedOptions.maxAttempts) {
logger.log('info', `\nUsing ${parser.name} to parse output\n`)
Expand Down
11 changes: 11 additions & 0 deletions test/unit/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ describe('Protractor Flake', () => {
spawnStub.endCallback(1)
})

it('calls callback with output from protractor process if the status is 0', (done) => {
protractorFlake({maxAttempts: 1}, (status: number, output: string) => {
expect(status).to.equal(status, 0)
expect(output).to.equal('Test')
done()
})

spawnStub.dataCallback('Test')
spawnStub.endCallback(0)
})

it('does not blow up if no callback is passed', function () {
protractorFlake({maxAttempts: 1})

Expand Down