Created
April 11, 2019 17:36
-
-
Save Vittly/bf4cdfe21ed657b4a61879d77f9fc21e to your computer and use it in GitHub Desktop.
ts-mock-imports issue file
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
export function storiesOf(): string; |
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
Object.defineProperty(exports, "storiesOf", { | |
enumerable: true, | |
get: function() { | |
return () => 'abc'; | |
} | |
}); |
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
import { assert } from 'chai'; | |
import { describe, it } from 'mocha'; | |
import { ImportMock } from 'ts-mock-imports'; | |
import * as Module from './bar'; | |
ImportMock.mockFunction(Module, 'storiesOf', 'xyz'); | |
import fooFn from './foo'; // which in fact should call Module.storiesOf | |
describe('foo', () => { | |
it('should do the magic', () => { | |
assert.strictEqual(fooFn(), 'xyz'); | |
}); | |
}); |
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
import * as Module from './bar'; | |
export default function() { | |
return Module.storiesOf(); | |
} |
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
mocha --require ts-node/register *.test.ts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment