Last active
June 1, 2016 01:15
-
-
Save distributedlife/afd268b9e743b784526ac51f397145b3 to your computer and use it in GitHub Desktop.
Imports are hoisted in es6
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 sinon from 'sinon'; | |
let config = require('./path/to/config'); | |
sinon.stub(config, 'get').returns({ port: 1234 }); | |
import * as database from './path/to/database' | |
//The port is whatever the default is from config. | |
//What is really going is the above is being intepreted as: | |
import sinon from 'sinon'; | |
import * as database from './path/to/database' | |
let config = require('./path/to/config'); | |
sinon.stub(config, 'get').returns({ port: 1234 }); |
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 sinon from 'sinon'; | |
let config = require('./path/to/config'); | |
sinon.stub(config, 'get').returns({ port: 1234 }); | |
let database = require('./path/to/database'); | |
//The port is 1234 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment