-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fe4ce4
commit b5ebb55
Showing
19 changed files
with
225 additions
and
203 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 was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/__tests__/logger/LineIntegration.test.ts → ...tests__/transport/LineIntegration.test.ts
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
2 changes: 1 addition & 1 deletion
2
...__tests__/logger/SlackIntegration.test.ts → ...ests__/transport/SlackIntegration.test.ts
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
jest.mock('date-fns', () => ({ | ||
format: jest | ||
.fn() | ||
.mockImplementationOnce(() => { | ||
throw new Error(); | ||
}) | ||
.mockImplementationOnce(() => { | ||
throw new Error('test'); | ||
}) | ||
})); | ||
|
||
import pretty from '../../transport/pretty'; | ||
import { Readable } from 'stream'; | ||
|
||
test('pretty split callback throws', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 40, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty split callback throws 2', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 40, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import pretty from '../../transport/pretty'; | ||
import { Readable } from 'stream'; | ||
|
||
test('pretty', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 40, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty no label', () => { | ||
const result = pretty({ colorize: true, withLabel: false, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 40, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty debug', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 20, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty no debug', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: false }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 20, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty no label/debug', () => { | ||
const result = pretty({ colorize: true, withLabel: false, debug: false }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 20, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty no color/label/debug', () => { | ||
const result = pretty({ colorize: false, withLabel: false, debug: false }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": "Test message", "time": 1514074545477, "level": 20, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); | ||
|
||
test('pretty invalid json', () => { | ||
const result = pretty({ colorize: true, withLabel: true, debug: true }); | ||
const stream = new Readable(); | ||
stream.push('{ "msg": Test message", "time": 1514074545477, "level": 40, "label": "TestStream" }'); | ||
stream.push(null); | ||
stream.pipe(result).pipe(process.stdout); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.