Closed
Description
TypeScript Version: 3.9.2, 3.9.3
Search Terms: sinon, stub
Code
// file: ./src/stubber/index.ts
export { toStub } from './to-stub'
// file: ./src/stubber/to-stub.ts
export const toStub = () => {
console.log('real stub')
}
// file: ./src/start.ts
import * as sinon from 'sinon'
import * as stubber from './stubber'
(async () => {
sinon.stub(stubber, 'toStub').callsFake(() => {
console.log('fake stub')
})
stubber.toStub()
})()
Run the start.ts script by compiling it with tsc
or simply use ts-node
.
I'd expect it print fake stub but now it prints real stub. It's working as expected for [email protected] or lower, start breaking from 3.9.2.
Expected behavior:
Print "fake stub"
Actual behavior:
Print "real stub"
Playground Link: Can't provide Playground link because it contains multiple files
Related Issues: Nope