Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
Test that demonstrates handing issue with broken imports on running t…
Browse files Browse the repository at this point in the history
…ests 😭

When Webpack fails to resolve a dependency, Karma doesn’t get notified at all about the broken build, and the process just hangs.

Transpilation errors behave as expected.
  • Loading branch information
pirelenito committed Jan 2, 2018
1 parent a5fae77 commit 8b94f5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import('name-that-is-invalid')

describe('my project', function() {
it('should work not work at all', function() {})
})
13 changes: 13 additions & 0 deletions spec/integration/index.integration-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ describe('[integration] sagui', function () {
const projectContentCustomPrettierOptionsInEslintrc = path.join(__dirname, '../fixtures/project-content-with-custom-prettier-options-in-eslintrc')
const projectContentWithDynamicImports = path.join(__dirname, '../fixtures/project-content-with-dynamic-import')
const projectContentWithCaseMismatchInModulePath = path.join(__dirname, '../fixtures/project-with-case-mismatch-in-module-paths')
const projectContentWithInvalidImports = path.join(__dirname, '../fixtures/project-content-with-invalid-import')

let projectPath, projectSrcPath

beforeEach(function () {
Expand Down Expand Up @@ -482,5 +484,16 @@ npm-debug.log`)
)
})
})

describe('when there are invalid imports', () => {
it('should not hang the test runner', async () => {
fs.copySync(projectContentWithInvalidImports, projectPath, { overwrite: true })
await sagui({ projectPath, action: actions.TEST_UNIT })
.then(
() => { throw new Error('It should have failed') },
(error) => expect(error).to.eql(1)
)
})
})
})
})

0 comments on commit 8b94f5a

Please sign in to comment.