-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve unit tests feedback loop by making (#241)
them asynchronous
- Loading branch information
Showing
26 changed files
with
240 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,43 @@ | ||
import pack from './utils/pack'; | ||
|
||
describe('emit error', () => { | ||
it('should not emit errors if emitError is false', (done) => { | ||
it('should not emit errors if emitError is false', async () => { | ||
const compiler = pack('error', { emitError: false }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasErrors()).toBe(false); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasErrors()).toBe(false); | ||
}); | ||
|
||
it('should emit errors if emitError is undefined', (done) => { | ||
it('should emit errors if emitError is undefined', async () => { | ||
const compiler = pack('error', {}); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasErrors()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasErrors()).toBe(true); | ||
}); | ||
|
||
it('should emit errors if emitError is true', (done) => { | ||
it('should emit errors if emitError is true', async () => { | ||
const compiler = pack('error', { emitError: true }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasErrors()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasErrors()).toBe(true); | ||
}); | ||
|
||
it('should emit errors, but not warnings if emitError is true and emitWarning is false', (done) => { | ||
it('should emit errors, but not warnings if emitError is true and emitWarning is false', async () => { | ||
const compiler = pack('full-of-problems', { | ||
emitError: true, | ||
emitWarning: false, | ||
}); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(false); | ||
expect(stats.hasErrors()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(false); | ||
expect(stats.hasErrors()).toBe(true); | ||
}); | ||
|
||
it('should emit errors and warnings if emitError is true and emitWarning is undefined', (done) => { | ||
it('should emit errors and warnings if emitError is true and emitWarning is undefined', async () => { | ||
const compiler = pack('full-of-problems', { emitError: true }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,43 @@ | ||
import pack from './utils/pack'; | ||
|
||
describe('emit warning', () => { | ||
it('should not emit warnings if emitWarning is false', (done) => { | ||
it('should not emit warnings if emitWarning is false', async () => { | ||
const compiler = pack('warn', { emitWarning: false }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(false); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(false); | ||
}); | ||
|
||
it('should emit warnings if emitWarning is undefined', (done) => { | ||
it('should emit warnings if emitWarning is undefined', async () => { | ||
const compiler = pack('warn', {}); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
}); | ||
|
||
it('should emit warnings if emitWarning is true', (done) => { | ||
it('should emit warnings if emitWarning is true', async () => { | ||
const compiler = pack('warn', { emitWarning: true }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
}); | ||
|
||
it('should emit warnings, but not warnings if emitWarning is true and emitError is false', (done) => { | ||
it('should emit warnings, but not warnings if emitWarning is true and emitError is false', async () => { | ||
const compiler = pack('full-of-problems', { | ||
emitWarning: true, | ||
emitError: false, | ||
}); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(false); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(false); | ||
}); | ||
|
||
it('should emit warnings and errors if emitWarning is true and emitError is undefined', (done) => { | ||
it('should emit warnings and errors if emitWarning is true and emitError is undefined', async () => { | ||
const compiler = pack('full-of-problems', { emitWarning: true }); | ||
|
||
compiler.run((err, stats) => { | ||
expect(err).toBeNull(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(true); | ||
done(); | ||
}); | ||
const stats = await compiler.runAsync(); | ||
expect(stats.hasWarnings()).toBe(true); | ||
expect(stats.hasErrors()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.