Created
March 19, 2019 04:24
-
-
Save theKashey/151fc58a06e191b1142964981ffbf029 to your computer and use it in GitHub Desktop.
ava rewiremock
This file contains hidden or 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
import test from 'ava'; | |
import sinon from 'sinon'; | |
// nothing would be mocked before import | |
import rewiremock from 'rewiremock/node'; | |
import fs from 'fs'; | |
// ^ only this "FS" would be mocked | |
rewiremock('fs').mockThrough(() => sinon.stub()); | |
// ^ this line would be "hoisted" | |
// here rewiremock would disable itself. | |
fs.mount('/some/test/directory/', "what you were going to do?"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment