-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
89d5256
commit 83cac1b
Showing
8 changed files
with
91 additions
and
58 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
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,9 +1,37 @@ | ||
import assert from "assert"; | ||
import stub from "./_stub"; | ||
|
||
import logger from "../src/logger"; | ||
|
||
describe("logger", () => { | ||
it("should exist", () => { | ||
assert.ok(logger); | ||
}); | ||
describe("log levels", () => { | ||
let called; | ||
beforeEach(() => { | ||
called = false; | ||
stub(logger, "_emit", () => called = true); | ||
}); | ||
afterEach(() => logger.setLogLevel()); | ||
|
||
it("should suppress verbose by default", () => { | ||
logger.verbose("test"); | ||
assert.ok(!called); | ||
}); | ||
it("should emit verbose if configured", () => { | ||
logger.setLogLevel("verbose"); | ||
logger.verbose("test"); | ||
assert.ok(called); | ||
}); | ||
it("should emit error by default", () => { | ||
logger.error("test"); | ||
assert.ok(called); | ||
}); | ||
it("should suppress error if silent", () => { | ||
logger.setLogLevel("silent"); | ||
logger.error("test"); | ||
assert.ok(!called); | ||
}); | ||
}); | ||
}); |