Merge pull request #154 from overleaf/msm-dependency-update
Dependency update
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
// this file was auto-generated, do not edit it directly.
|
// this file was auto-generated, do not edit it directly.
|
||||||
// instead run bin/update_build_scripts from
|
// instead run bin/update_build_scripts from
|
||||||
// https://github.com/sharelatex/sharelatex-dev-environment
|
// https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
// Version: 1.3.5
|
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"standard",
|
"standard",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
{
|
{
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
FROM node:10.19.0 as base
|
FROM node:10.19.0 as base
|
||||||
|
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -1,7 +1,6 @@
|
|||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
BUILD_NUMBER ?= local
|
BUILD_NUMBER ?= local
|
||||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = ProjectPersistenceManager = {
|
|||||||
db.Project.findOrCreate({ where: { project_id } })
|
db.Project.findOrCreate({ where: { project_id } })
|
||||||
.spread((project, created) =>
|
.spread((project, created) =>
|
||||||
project
|
project
|
||||||
.updateAttributes({ lastAccessed: new Date() })
|
.update({ lastAccessed: new Date() })
|
||||||
.then(() => cb())
|
.then(() => cb())
|
||||||
.error(cb)
|
.error(cb)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ const UrlCache = require('./UrlCache')
|
|||||||
const Path = require('path')
|
const Path = require('path')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const async = require('async')
|
const async = require('async')
|
||||||
const mkdirp = require('mkdirp')
|
|
||||||
const OutputFileFinder = require('./OutputFileFinder')
|
const OutputFileFinder = require('./OutputFileFinder')
|
||||||
const ResourceStateManager = require('./ResourceStateManager')
|
const ResourceStateManager = require('./ResourceStateManager')
|
||||||
const Metrics = require('./Metrics')
|
const Metrics = require('./Metrics')
|
||||||
@@ -302,7 +301,7 @@ module.exports = ResourceWriter = {
|
|||||||
if (error != null) {
|
if (error != null) {
|
||||||
return callback(error)
|
return callback(error)
|
||||||
}
|
}
|
||||||
return mkdirp(Path.dirname(path), function(error) {
|
return fs.mkdir(Path.dirname(path), { recursive: true }, function(error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
return callback(error)
|
return callback(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ module.exports = UrlCache = {
|
|||||||
callback = function(error, urlDetails) {}
|
callback = function(error, urlDetails) {}
|
||||||
}
|
}
|
||||||
const job = cb =>
|
const job = cb =>
|
||||||
db.UrlCache.find({ where: { url, project_id } })
|
db.UrlCache.findOne({ where: { url, project_id } })
|
||||||
.then(urlDetails => cb(null, urlDetails))
|
.then(urlDetails => cb(null, urlDetails))
|
||||||
.error(cb)
|
.error(cb)
|
||||||
return dbQueue.queue.push(job, callback)
|
return dbQueue.queue.push(job, callback)
|
||||||
@@ -241,7 +241,7 @@ module.exports = UrlCache = {
|
|||||||
db.UrlCache.findOrCreate({ where: { url, project_id } })
|
db.UrlCache.findOrCreate({ where: { url, project_id } })
|
||||||
.spread((urlDetails, created) =>
|
.spread((urlDetails, created) =>
|
||||||
urlDetails
|
urlDetails
|
||||||
.updateAttributes({ lastModified })
|
.update({ lastModified })
|
||||||
.then(() => cb())
|
.then(() => cb())
|
||||||
.error(cb)
|
.error(cb)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
clsi
|
clsi
|
||||||
--public-repo=True
|
|
||||||
--language=es
|
|
||||||
--env-add=
|
|
||||||
--node-version=10.19.0
|
|
||||||
--acceptance-creds=None
|
--acceptance-creds=None
|
||||||
--dependencies=
|
--dependencies=
|
||||||
--docker-repos=gcr.io/overleaf-ops
|
--docker-repos=gcr.io/overleaf-ops
|
||||||
|
--env-add=
|
||||||
--env-pass-through=TEXLIVE_IMAGE
|
--env-pass-through=TEXLIVE_IMAGE
|
||||||
--script-version=1.3.5
|
--language=es
|
||||||
|
--node-version=10.19.0
|
||||||
|
--public-repo=True
|
||||||
|
--script-version=2.0.0
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
version: "2.3"
|
version: "2.3"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
version: "2.3"
|
version: "2.3"
|
||||||
|
|
||||||
|
|||||||
1830
package-lock.json
generated
1830
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
57
package.json
57
package.json
@@ -14,37 +14,36 @@
|
|||||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||||
"nodemon": "nodemon --config nodemon.json",
|
"nodemon": "nodemon --config nodemon.json",
|
||||||
"lint": "node_modules/.bin/eslint .",
|
"lint": "node_modules/.bin/eslint .",
|
||||||
"format": "node_modules/.bin/prettier-eslint '**/*.js' --list-different",
|
"format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
|
||||||
"format:fix": "node_modules/.bin/prettier-eslint '**/*.js' --write"
|
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
|
||||||
},
|
},
|
||||||
"author": "James Allen <james@sharelatex.com>",
|
"author": "James Allen <james@sharelatex.com>",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "0.2.9",
|
"async": "3.2.0",
|
||||||
"body-parser": "^1.2.0",
|
"body-parser": "^1.19.0",
|
||||||
"dockerode": "^2.5.3",
|
"dockerode": "^3.1.0",
|
||||||
"express": "^4.2.0",
|
"express": "^4.17.1",
|
||||||
"fs-extra": "^0.16.3",
|
"fs-extra": "^8.1.0",
|
||||||
"heapdump": "^0.3.5",
|
"heapdump": "^0.3.15",
|
||||||
"lockfile": "^1.0.3",
|
"lockfile": "^1.0.4",
|
||||||
"logger-sharelatex": "^1.9.0",
|
"logger-sharelatex": "^1.9.0",
|
||||||
"lynx": "0.0.11",
|
"lynx": "0.2.0",
|
||||||
"metrics-sharelatex": "^2.3.0",
|
"metrics-sharelatex": "^2.6.0",
|
||||||
"mkdirp": "0.3.5",
|
"mysql": "^2.18.1",
|
||||||
"mysql": "2.6.2",
|
"request": "^2.88.2",
|
||||||
"request": "^2.21.0",
|
"sequelize": "^5.21.5",
|
||||||
"sequelize": "^4.38.0",
|
|
||||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0",
|
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0",
|
||||||
"smoke-test-sharelatex": "git+https://github.com/sharelatex/smoke-test-sharelatex.git#v0.2.0",
|
"smoke-test-sharelatex": "git+https://github.com/sharelatex/smoke-test-sharelatex.git#v0.2.0",
|
||||||
"sqlite3": "^4.0.6",
|
"sqlite3": "^4.1.1",
|
||||||
"underscore": "^1.8.2",
|
"underscore": "^1.9.2",
|
||||||
"v8-profiler-node8": "^6.0.1",
|
"v8-profiler-node8": "^6.1.1",
|
||||||
"wrench": "~1.5.4"
|
"wrench": "~1.5.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.0.3",
|
"babel-eslint": "^10.1.0",
|
||||||
"bunyan": "^0.22.1",
|
"bunyan": "^1.8.12",
|
||||||
"chai": "~1.8.1",
|
"chai": "~4.2.0",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.10.0",
|
"eslint-config-prettier": "^6.10.0",
|
||||||
"eslint-config-standard": "^14.1.0",
|
"eslint-config-standard": "^14.1.0",
|
||||||
"eslint-config-standard-jsx": "^8.1.0",
|
"eslint-config-standard-jsx": "^8.1.0",
|
||||||
@@ -53,17 +52,17 @@
|
|||||||
"eslint-plugin-chai-friendly": "^0.5.0",
|
"eslint-plugin-chai-friendly": "^0.5.0",
|
||||||
"eslint-plugin-import": "^2.20.1",
|
"eslint-plugin-import": "^2.20.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||||
"eslint-plugin-mocha": "^6.2.2",
|
"eslint-plugin-mocha": "^6.3.0",
|
||||||
"eslint-plugin-node": "^11.0.0",
|
"eslint-plugin-node": "^11.0.0",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"eslint-plugin-react": "^7.18.3",
|
"eslint-plugin-react": "^7.19.0",
|
||||||
"eslint-plugin-standard": "^4.0.1",
|
"eslint-plugin-standard": "^4.0.1",
|
||||||
"mocha": "^4.0.1",
|
"mocha": "^7.1.0",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"prettier-eslint-cli": "^5.0.0",
|
"prettier-eslint-cli": "^5.0.0",
|
||||||
"sandboxed-module": "~0.3.0",
|
"sandboxed-module": "^2.0.3",
|
||||||
"sinon": "~1.7.3",
|
"sinon": "~9.0.1",
|
||||||
"timekeeper": "0.0.4"
|
"timekeeper": "2.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,10 +347,10 @@ describe('CompileManager', function() {
|
|||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error from the stderr', function() {
|
it('should call the callback with an error from the stderr', function() {
|
||||||
this.callback.calledWith(new Error()).should.equal(true)
|
this.callback.calledWithExactly(sinon.match(Error)).should.equal(true)
|
||||||
|
|
||||||
return this.callback.args[0][0].message.should.equal(
|
this.callback.args[0][0].message.should.equal(
|
||||||
`rm -r ${this.Settings.path.compilesDir}/${this.project_id}-${this.user_id} failed: ${this.error}`
|
`rm -r ${this.Settings.path.compilesDir}/${this.project_id}-${this.user_id} failed: ${this.error}`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -464,8 +464,8 @@ describe('DockerRunner', function() {
|
|||||||
return this.createContainer.called.should.equal(false)
|
return this.createContainer.called.should.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
return this.callback.calledWith(new Error()).should.equal(true)
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -488,8 +488,8 @@ describe('DockerRunner', function() {
|
|||||||
return this.createContainer.called.should.equal(false)
|
return this.createContainer.called.should.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
return this.callback.calledWith(new Error()).should.equal(true)
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -582,10 +582,12 @@ describe('DockerRunner', function() {
|
|||||||
return this.container.kill.called.should.equal(true)
|
return this.container.kill.called.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
const error = new Error('container timed out')
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
error.timedout = true
|
|
||||||
return this.callback.calledWith(error).should.equal(true)
|
const errorObj = this.callback.args[0][0]
|
||||||
|
expect(errorObj.message).to.include('container timed out')
|
||||||
|
expect(errorObj.timedout).equal(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -84,9 +84,10 @@ describe('DockerLockManager', function() {
|
|||||||
return this.runner.called.should.equal(false)
|
return this.runner.called.should.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should return an error', function() {
|
it('should return an error', function() {
|
||||||
const error = new Errors.AlreadyCompilingError()
|
this.callback
|
||||||
return this.callback.calledWithExactly(error).should.equal(true)
|
.calledWithExactly(sinon.match(Errors.AlreadyCompilingError))
|
||||||
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
const SandboxedModule = require('sandboxed-module')
|
const SandboxedModule = require('sandboxed-module')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
|
const { expect } = require('chai')
|
||||||
const should = require('chai').should()
|
const should = require('chai').should()
|
||||||
const modulePath = require('path').join(
|
const modulePath = require('path').join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -22,6 +23,7 @@ const Errors = require('../../../app/js/Errors')
|
|||||||
describe('ResourceStateManager', function() {
|
describe('ResourceStateManager', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
this.ResourceStateManager = SandboxedModule.require(modulePath, {
|
this.ResourceStateManager = SandboxedModule.require(modulePath, {
|
||||||
|
singleOnly: true,
|
||||||
requires: {
|
requires: {
|
||||||
fs: (this.fs = {}),
|
fs: (this.fs = {}),
|
||||||
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
|
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
|
||||||
@@ -132,11 +134,13 @@ describe('ResourceStateManager', function() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
const error = new Errors.FilesOutOfSyncError(
|
this.callback
|
||||||
'invalid state for incremental update'
|
.calledWith(sinon.match(Errors.FilesOutOfSyncError))
|
||||||
)
|
.should.equal(true)
|
||||||
return this.callback.calledWith(error).should.equal(true)
|
|
||||||
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('invalid state for incremental update')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -174,11 +178,15 @@ describe('ResourceStateManager', function() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
const error = new Errors.FilesOutOfSyncError(
|
this.callback
|
||||||
|
.calledWith(sinon.match(Errors.FilesOutOfSyncError))
|
||||||
|
.should.equal(true)
|
||||||
|
|
||||||
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include(
|
||||||
'resource files missing in incremental update'
|
'resource files missing in incremental update'
|
||||||
)
|
)
|
||||||
return this.callback.calledWith(error).should.equal(true)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -198,10 +206,11 @@ describe('ResourceStateManager', function() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
return this.callback
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
.calledWith(new Error('relative path in resource file list'))
|
|
||||||
.should.equal(true)
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('relative path in resource file list')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
const SandboxedModule = require('sandboxed-module')
|
const SandboxedModule = require('sandboxed-module')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
|
const { expect } = require('chai')
|
||||||
const should = require('chai').should()
|
const should = require('chai').should()
|
||||||
const modulePath = require('path').join(
|
const modulePath = require('path').join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -23,6 +24,7 @@ describe('ResourceWriter', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
let Timer
|
let Timer
|
||||||
this.ResourceWriter = SandboxedModule.require(modulePath, {
|
this.ResourceWriter = SandboxedModule.require(modulePath, {
|
||||||
|
singleOnly: true,
|
||||||
requires: {
|
requires: {
|
||||||
fs: (this.fs = {
|
fs: (this.fs = {
|
||||||
mkdir: sinon.stub().callsArg(1),
|
mkdir: sinon.stub().callsArg(1),
|
||||||
@@ -31,7 +33,6 @@ describe('ResourceWriter', function() {
|
|||||||
'./ResourceStateManager': (this.ResourceStateManager = {}),
|
'./ResourceStateManager': (this.ResourceStateManager = {}),
|
||||||
wrench: (this.wrench = {}),
|
wrench: (this.wrench = {}),
|
||||||
'./UrlCache': (this.UrlCache = {}),
|
'./UrlCache': (this.UrlCache = {}),
|
||||||
mkdirp: (this.mkdirp = sinon.stub().callsArg(1)),
|
|
||||||
'./OutputFileFinder': (this.OutputFileFinder = {}),
|
'./OutputFileFinder': (this.OutputFileFinder = {}),
|
||||||
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
|
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
|
||||||
'./Metrics': (this.Metrics = {
|
'./Metrics': (this.Metrics = {
|
||||||
@@ -346,6 +347,7 @@ describe('ResourceWriter', function() {
|
|||||||
describe('_writeResourceToDisk', function() {
|
describe('_writeResourceToDisk', function() {
|
||||||
describe('with a url based resource', function() {
|
describe('with a url based resource', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
this.fs.mkdir = sinon.stub().callsArg(2)
|
||||||
this.resource = {
|
this.resource = {
|
||||||
path: 'main.tex',
|
path: 'main.tex',
|
||||||
url: 'http://www.example.com/main.tex',
|
url: 'http://www.example.com/main.tex',
|
||||||
@@ -363,7 +365,7 @@ describe('ResourceWriter', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should ensure the directory exists', function() {
|
it('should ensure the directory exists', function() {
|
||||||
return this.mkdirp
|
this.fs.mkdir
|
||||||
.calledWith(
|
.calledWith(
|
||||||
path.dirname(path.join(this.basePath, this.resource.path))
|
path.dirname(path.join(this.basePath, this.resource.path))
|
||||||
)
|
)
|
||||||
@@ -397,6 +399,7 @@ describe('ResourceWriter', function() {
|
|||||||
content: 'Hello world'
|
content: 'Hello world'
|
||||||
}
|
}
|
||||||
this.fs.writeFile = sinon.stub().callsArg(2)
|
this.fs.writeFile = sinon.stub().callsArg(2)
|
||||||
|
this.fs.mkdir = sinon.stub().callsArg(2)
|
||||||
return this.ResourceWriter._writeResourceToDisk(
|
return this.ResourceWriter._writeResourceToDisk(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
this.resource,
|
this.resource,
|
||||||
@@ -406,7 +409,7 @@ describe('ResourceWriter', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should ensure the directory exists', function() {
|
it('should ensure the directory exists', function() {
|
||||||
return this.mkdirp
|
return this.fs.mkdir
|
||||||
.calledWith(
|
.calledWith(
|
||||||
path.dirname(path.join(this.basePath, this.resource.path))
|
path.dirname(path.join(this.basePath, this.resource.path))
|
||||||
)
|
)
|
||||||
@@ -446,10 +449,11 @@ describe('ResourceWriter', function() {
|
|||||||
return this.fs.writeFile.called.should.equal(false)
|
return this.fs.writeFile.called.should.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should return an error', function() {
|
it('should return an error', function() {
|
||||||
return this.callback
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
.calledWith(new Error('resource path is outside root directory'))
|
|
||||||
.should.equal(true)
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('resource path is outside root directory')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -467,21 +471,18 @@ describe('ResourceWriter', function() {
|
|||||||
|
|
||||||
describe('with an invalid path', function() {
|
describe('with an invalid path', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
return this.ResourceWriter.checkPath(
|
this.ResourceWriter.checkPath('foo', 'baz/../../bar', this.callback)
|
||||||
'foo',
|
|
||||||
'baz/../../bar',
|
|
||||||
this.callback
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should return an error', function() {
|
it('should return an error', function() {
|
||||||
return this.callback
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
.calledWith(new Error('resource path is outside root directory'))
|
|
||||||
.should.equal(true)
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('resource path is outside root directory')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return describe('with another invalid path matching on a prefix', function() {
|
describe('with another invalid path matching on a prefix', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
return this.ResourceWriter.checkPath(
|
return this.ResourceWriter.checkPath(
|
||||||
'foo',
|
'foo',
|
||||||
@@ -490,10 +491,11 @@ describe('ResourceWriter', function() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should return an error', function() {
|
it('should return an error', function() {
|
||||||
return this.callback
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
.calledWith(new Error('resource path is outside root directory'))
|
|
||||||
.should.equal(true)
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('resource path is outside root directory')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
const SandboxedModule = require('sandboxed-module')
|
const SandboxedModule = require('sandboxed-module')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
|
const { expect } = require('chai')
|
||||||
require('chai').should()
|
require('chai').should()
|
||||||
const modulePath = require('path').join(__dirname, '../../../app/js/UrlFetcher')
|
const modulePath = require('path').join(__dirname, '../../../app/js/UrlFetcher')
|
||||||
const { EventEmitter } = require('events')
|
const { EventEmitter } = require('events')
|
||||||
@@ -140,10 +141,11 @@ describe('UrlFetcher', function() {
|
|||||||
return this.urlStream.emit('end')
|
return this.urlStream.emit('end')
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should call the callback with an error', function() {
|
it('should call the callback with an error', function() {
|
||||||
return this.callback
|
this.callback.calledWith(sinon.match(Error)).should.equal(true)
|
||||||
.calledWith(new Error('URL returned non-success status code: 404'))
|
|
||||||
.should.equal(true)
|
const message = this.callback.args[0][0].message
|
||||||
|
expect(message).to.include('URL returned non-success status code: 404')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user