Skip to content

Instantly share code, notes, and snippets.

@moriya-hm5
Created January 17, 2020 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moriya-hm5/193af67c38115b4e749229c5aa1b7d49 to your computer and use it in GitHub Desktop.
Save moriya-hm5/193af67c38115b4e749229c5aa1b7d49 to your computer and use it in GitHub Desktop.
const chai = require('chai')
const sinon = require('sinon')
const sandbox = sinon.createSandbox()
const expect = chai.expect
describe('sinon', function () {
it('sinonのテスト', function(){
sandbox.stub(process.env, 'PATH').value('12345')
expect(process.env.PATH).to.equal('12345') // passになる
})
afterEach(function () {
sandbox.restore()
});
after(function () {
sinon.restore()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment