Merge pull request #1807 from overleaf/as-global-sinon-chai

Globally load sinon-chai

GitOrigin-RevId: b0175e021b98d6338171108c6778de80ee58479a
This commit is contained in:
Alasdair Smith 2019-05-28 12:04:44 +01:00 committed by sharelatex
parent 4e8facf3cc
commit a3bcc71df9
7 changed files with 7 additions and 10 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -e;
MOCHA="node_modules/.bin/mocha --exit --recursive --reporter spec"
MOCHA="node_modules/.bin/mocha --exit --recursive --reporter spec --require test/unit/bootstrap.js"
$MOCHA "$@" test/unit/js

View file

@ -1,6 +1,6 @@
#!/bin/bash
set -e;
MOCHA="node_modules/.bin/mocha --exit --recursive --reporter spec"
MOCHA="node_modules/.bin/mocha --exit --recursive --reporter spec --require test/unit/bootstrap.js"
$MOCHA "$@" test/unit/js

5
services/web/test/unit/bootstrap.js vendored Normal file
View file

@ -0,0 +1,5 @@
const chai = require('chai')
// Load sinon-chai assertions so expect(stubFn).to.have.been.calledWith('abc')
// has a nicer failure messages
chai.use(require('sinon-chai'))

View file

@ -1,7 +1,5 @@
sinon = require('sinon')
chai = require('chai')
sinonChai = require "sinon-chai"
chai.use sinonChai
should = chai.should()
expect = chai.expect
modulePath = "../../../../app/js/Features/Authentication/AuthenticationController.js"

View file

@ -4,9 +4,7 @@ SandboxedModule = require "sandboxed-module"
assert = require "assert"
chai = require "chai"
sinon = require "sinon"
sinonChai = require "sinon-chai"
chai.use sinonChai
expect = chai.expect
modulePath = Path.join __dirname, "../../../../app/js/Features/Project/ProjectCollabratecDetailsHandler"

View file

@ -2,10 +2,8 @@ SandboxedModule = require('sandboxed-module')
assert = require('assert')
chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
chai.should()
chai.use(sinonChai)
expect = chai.expect
modulePath = '../../../../app/js/Features/Templates/TemplatesController'

View file

@ -2,10 +2,8 @@ SandboxedModule = require('sandboxed-module')
assert = require('assert')
chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
should = require('chai').should()
chai.use(sinonChai)
modulePath = '../../../../app/js/Features/Templates/TemplatesManager'