Skip to content

Commit 50e65b3

Browse files
committed
Making sure to add custom matchers
1 parent de5b5c0 commit 50e65b3

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
module.exports = {
2-
verbose: true
2+
verbose: true,
3+
setupFilesAfterEnv: [
4+
'./test/setup.ts'
5+
]
36
}

test/setup.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { toContainGraph } from './custom-matchers/toContainGraph'
22
import { toEqualGraph } from './custom-matchers/toEqualGraph'
3+
import { error, log, trace, warn } from '../src/debug'
34

45
// We don't want to output debug messages to console as part of the tests
56
jest.mock('../src/debug')
6-
const debug = require('../src/debug')
7-
debug.log.mockImplementation(() => null)
8-
debug.warn.mockImplementation(() => null)
9-
debug.error.mockImplementation(() => null)
10-
debug.trace.mockImplementation(() => null)
7+
8+
export function silenceDebugMessages () {
9+
;(log as any).mockImplementation(() => null)
10+
;(warn as any).mockImplementation(() => null)
11+
;(error as any).mockImplementation(() => null)
12+
;(trace as any).mockImplementation(() => null)
13+
}
1114

1215
// adding custom matchers
1316
expect.extend({

0 commit comments

Comments
 (0)