-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This might be a little bit more useful in usage than an array, especially where code might require a tuple as argument. As `levels` was recently introduced there is likely very little impact of this change, regardless, it is a breaking change.
- Loading branch information
Showing
2 changed files
with
14 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
import test from 'ava'; | ||
import {type LogLevelString} from 'bunyan'; | ||
import levels from './levels.js'; | ||
|
||
test('contains all Bunyan levels', (t) => { | ||
t.deepEqual(levels, ['trace', 'debug', 'info', 'warn', 'error', 'fatal']); | ||
}); | ||
|
||
const isValidLevel = test.macro<[(typeof levels)[number]]>({ | ||
exec(t, level) { | ||
const bunaynLevel: LogLevelString = level; | ||
t.is(level, bunaynLevel); | ||
}, | ||
title: (_, level) => `"${level} is a valid Bunyan level`, | ||
}); | ||
|
||
for (const level of levels) { | ||
test(isValidLevel, level); | ||
} |
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,12 +1,3 @@ | ||
import {type LogLevelString} from 'bunyan'; | ||
|
||
const levels: readonly LogLevelString[] = [ | ||
'trace', | ||
'debug', | ||
'info', | ||
'warn', | ||
'error', | ||
'fatal', | ||
] as const; | ||
const levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'] as const; | ||
|
||
export default levels; |