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

test(generator-handler): Attempt to improve flaky test #15884

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('generatorHandler', () => {
jest.retryTimes(3)

const generator = new GeneratorProcess(getExecutable('invalid-executable'))
await expect(() => generator.init()).rejects.toThrow('Cannot find module')
await expect(() => generator.init()).rejects.toThrow('something terrible happened')
})

test('minimal-executable', async () => {
Expand Down
14 changes: 2 additions & 12 deletions packages/generator-helper/src/__tests__/invalid-executable
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#!/usr/bin/env node

// let's provoke this to fail by requiring an unexisting module
require('modulethatdoesnotexist/something')

const { generatorHandler } = require('../generatorHandler')

generatorHandler({
async onGenerate() {
await new Promise((r) => {
setTimeout(r, 500)
})
},
})
console.error('something terrible happened')
process.exit(1)