Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
feat: allow upload without screenshot with externalBuildId
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Oct 18, 2019
1 parent ff600c1 commit 6c6a5d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function upload(options) {

const screenshots = await readScreenshots({ cwd: directory, ignore })

if (screenshots.length === 0) {
if (screenshots.length === 0 && !externalBuildId) {
throw new UploadError(
`The path provided doesn't contain any image (${GLOB_PATTERN}).`,
)
Expand Down
13 changes: 13 additions & 0 deletions src/upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ describe('upload', () => {
})

describe('without screenshots', () => {
beforeEach(() => {
fetch.mockImplementation(async () => {})
})

it('should throw', async () => {
expect.assertions(1)

Expand All @@ -101,6 +105,15 @@ describe('upload', () => {
)
}
})

it('should not throw with externalBuildId', async () => {
await upload({
directory: path.join(__dirname, '../__fixtures__/screenshots/empty'),
token: 'myToken',
externalBuildId: 'x',
})
expect(fetch).toHaveBeenCalled()
})
})

describe('with all good', () => {
Expand Down

0 comments on commit 6c6a5d5

Please sign in to comment.