Skip to content

Commit 2b799a6

Browse files
committed
test: cover import-time process side effects
1 parent c5d7be2 commit 2b799a6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/import.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const assert = require("assert")
2+
3+
describe("Testing module import", () => {
4+
it("doesn't install an uncaughtException handler when imported", () => {
5+
const modulePath = require.resolve("../index.js")
6+
const listenersBefore = process.listenerCount("uncaughtException")
7+
8+
delete require.cache[modulePath]
9+
require(modulePath)
10+
11+
assert.strictEqual(
12+
process.listenerCount("uncaughtException"),
13+
listenersBefore
14+
)
15+
})
16+
})

0 commit comments

Comments
 (0)