boar-server
Advanced tools
Comparing version 8.1.0 to 9.0.0
@@ -8,2 +8,3 @@ 'use strict'; | ||
const App = require('./'); | ||
const co = require('co'); | ||
@@ -61,3 +62,3 @@ let sandbox; | ||
it('should return a promise that resolves after all servers had closed', function* () { | ||
it('should return a promise that resolves after all servers had closed', co.wrap(function* () { | ||
process.env.SERVE_HTTPS = 'true'; | ||
@@ -86,5 +87,4 @@ | ||
expect(closeResolved).to.be.true; | ||
}); | ||
})); | ||
it('should not call close on already closed servers', function() { | ||
@@ -91,0 +91,0 @@ const httpServer = createFakeServer(); |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var errorHandler = require('./error-handler'); | ||
const co = require('co'); | ||
@@ -35,3 +36,3 @@ describe('Error Handler Middleware', function() { | ||
it('should render error page if specified', function* () { | ||
it('should render error page if specified', co.wrap(function* () { | ||
var middleware = errorHandler(ERROR_PAGE_PATH); | ||
@@ -43,5 +44,5 @@ | ||
expect(fakeContext.renderArgs.data).to.eql({ message: DEFAULT_ERROR_MESSAGE }); | ||
}); | ||
})); | ||
it('should render error to request body if no error page path specified', function* () { | ||
it('should render error to request body if no error page path specified', co.wrap(function* () { | ||
var middleware = errorHandler(); | ||
@@ -52,5 +53,5 @@ | ||
expect(fakeContext.body).to.eql(DEFAULT_ERROR_MESSAGE); | ||
}); | ||
})); | ||
}); | ||
@@ -5,2 +5,3 @@ 'use strict'; | ||
var hook = require('./hook'); | ||
const co = require('co'); | ||
@@ -22,3 +23,3 @@ describe('Hook Middleware', function() { | ||
it('should call the given hook', function* () { | ||
it('should call the given hook', co.wrap(function* () { | ||
var middleware = hook.getMiddleware(); | ||
@@ -32,6 +33,6 @@ var called = false; | ||
expect(called).to.eql(true); | ||
}); | ||
})); | ||
it('should call the hooks in the given order before next', function* () { | ||
it('should call the hooks in the given order before next', co.wrap(function* () { | ||
var middleware = hook.getMiddleware(); | ||
@@ -48,6 +49,6 @@ var called = []; | ||
expect(called).to.eql(['hookSpy1', 'hookSpy2', 'next']); | ||
}); | ||
})); | ||
it('should call the given hook in the context of the middleware', function* () { | ||
it('should call the given hook in the context of the middleware', co.wrap(function* () { | ||
var context = {}; | ||
@@ -62,3 +63,3 @@ var middleware = hook.getMiddleware(); | ||
expect(calledwith).to.equal(context); | ||
}); | ||
})); | ||
@@ -69,3 +70,3 @@ }); | ||
it('should remove all the hooks', function* () { | ||
it('should remove all the hooks', co.wrap(function* () { | ||
var middleware = hook.getMiddleware(); | ||
@@ -80,3 +81,3 @@ var called = false; | ||
expect(called).to.eql(false); | ||
}); | ||
})); | ||
@@ -83,0 +84,0 @@ }); |
@@ -6,5 +6,6 @@ 'use strict'; | ||
const helper = require('./spec.helper'); | ||
const co = require('co'); | ||
describe('ClearCollections', function () { | ||
it('should use the supplied clear function to clear all collections', function* () { | ||
it('should use the supplied clear function to clear all collections', co.wrap(function* () { | ||
const cleared = []; | ||
@@ -16,3 +17,3 @@ const clearFn = collection => cleared.push(collection.name) | ||
expect(cleared).to.eql(helper.collectionNames); | ||
}); | ||
})); | ||
}); |
@@ -6,5 +6,6 @@ 'use strict'; | ||
const helper = require('../clear-collections/spec.helper'); | ||
const co = require('co'); | ||
describe('Drop collections', function () { | ||
it('should call drop on collections', function*() { | ||
it('should call drop on collections', co.wrap(function*() { | ||
const dropped = []; | ||
@@ -24,4 +25,4 @@ const droppingCollection = function (name) { | ||
expect(dropped).to.eql(helper.collectionNames) | ||
}); | ||
})); | ||
}); | ||
@@ -5,2 +5,3 @@ 'use strict'; | ||
var handleException = require('./'); | ||
const co = require('co'); | ||
@@ -128,13 +129,15 @@ describe('Exception handler', function() { | ||
it('could be used with yield', function* (done) { | ||
var returnedFunction = function*() { done(); }; | ||
it('could be used with yield', function (done) { | ||
co(function* () { | ||
var returnedFunction = function*() { done(); }; | ||
yield handleException(error, true, { | ||
type: CustomError, | ||
execute: returnedFunction | ||
})(); | ||
yield handleException(error, true, { | ||
type: CustomError, | ||
execute: returnedFunction | ||
})(); | ||
}); | ||
}); | ||
it('should delegate exceptions on yield context as well', function* () { | ||
it('should delegate exceptions on yield context as well', co.wrap(function* () { | ||
try { | ||
@@ -150,3 +153,3 @@ yield handleException(error, true, { | ||
throw new Error('Unexpected error'); | ||
}); | ||
})); | ||
}); | ||
@@ -153,0 +156,0 @@ |
@@ -6,5 +6,6 @@ 'use strict'; | ||
const helper = require('../clear-collections/spec.helper'); | ||
const co = require('co'); | ||
describe('Truncate collections', function () { | ||
it('should truncate collections', function*() { | ||
it('should truncate collections', co.wrap(function*() { | ||
const truncated = []; | ||
@@ -25,4 +26,4 @@ const truncatingCollection = function (name) { | ||
expect(truncated).to.eql(helper.collectionNames); | ||
}); | ||
})); | ||
}); | ||
@@ -6,3 +6,3 @@ { | ||
"scripts": { | ||
"test": "mocha $(find . -name \"*.spec.js\" -not -path \"./node_modules/*\") --require co-mocha", | ||
"test": "mocha $(find . -name \"*.spec.js\" -not -path \"./node_modules/*\")", | ||
"prepublish": "npm test", | ||
@@ -21,28 +21,27 @@ "semantic-release": "semantic-release" | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=18" | ||
}, | ||
"homepage": "https://github.com/emartech/boar-server", | ||
"devDependencies": { | ||
"chai": "4.3.4", | ||
"co-mocha": "1.2.2", | ||
"mocha": "8.4.0", | ||
"semantic-release": "17.4.3", | ||
"sinon": "10.0.0", | ||
"sinon-chai": "3.6.0" | ||
"chai": "4.4.1", | ||
"co": "^4.6.0", | ||
"mocha": "^10.2.0", | ||
"semantic-release": "^23.0.0", | ||
"sinon": "17.0.1", | ||
"sinon-chai": "3.7.0" | ||
}, | ||
"dependencies": { | ||
"@emartech/json-logger": "7.2.3", | ||
"app-root-path": "3.0.0", | ||
"@emartech/json-logger": "8.0.2", | ||
"app-root-path": "3.1.0", | ||
"koa-bodyparser": "4.4.1", | ||
"koa-cors": "0.0.16", | ||
"koa-helmet": "1.2.0", | ||
"koa-helmet": "7.0.2", | ||
"koa-methodoverride": "2.0.0", | ||
"koa-pug": "5.0.0", | ||
"koa-requestid": "1.0.0", | ||
"koa-router": "5.4.2", | ||
"koa-pug": "5.1.1", | ||
"koa-requestid": "2.2.1", | ||
"koa-router": "12.0.1", | ||
"koa-ssl": "2.0.1", | ||
"koa-static": "2.1.0", | ||
"lodash": "4.17.21" | ||
"koa-static": "5.0.0" | ||
}, | ||
"version": "8.1.0" | ||
"version": "9.0.0" | ||
} |
42878
11
1011
+ Added@emartech/json-logger@8.0.2(transitive)
+ Addedapp-root-path@3.1.0(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedhelmet@6.2.0(transitive)
+ Addedis-plain-obj@3.0.0(transitive)
+ Addedkoa-compose@4.2.0(transitive)
+ Addedkoa-helmet@7.0.2(transitive)
+ Addedkoa-pug@5.1.1(transitive)
+ Addedkoa-requestid@2.2.1(transitive)
+ Addedkoa-router@12.0.1(transitive)
+ Addedkoa-send@5.0.1(transitive)
+ Addedkoa-static@5.0.0(transitive)
+ Addedpath-to-regexp@6.3.0(transitive)
+ Addeduuid@9.0.1(transitive)
- Removedlodash@4.17.21
- Removed@emartech/json-logger@7.2.3(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedapp-root-path@3.0.0(transitive)
- Removedat-least-node@1.0.0(transitive)
- Removedbowser@2.9.0(transitive)
- Removedcamelize@1.0.0(transitive)
- Removedco@4.6.0(transitive)
- Removedcontent-security-policy-builder@2.1.0(transitive)
- Removeddasherize@2.0.0(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddont-sniff-mimetype@1.1.0(transitive)
- Removedfeature-policy@0.3.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhelmet@3.23.3(transitive)
- Removedhelmet-crossdomain@0.4.0(transitive)
- Removedhelmet-csp@2.10.0(transitive)
- Removedhide-powered-by@1.1.0(transitive)
- Removedhpkp@2.0.0(transitive)
- Removedhsts@2.2.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedkoa-helmet@1.2.0(transitive)
- Removedkoa-pug@5.0.0(transitive)
- Removedkoa-requestid@1.0.0(transitive)
- Removedkoa-router@5.4.2(transitive)
- Removedkoa-send@3.3.0(transitive)
- Removedkoa-static@2.1.0(transitive)
- Removedlodash.camelcase@4.3.0(transitive)
- Removedlodash.forin@4.4.0(transitive)
- Removedlodash.isobject@3.0.2(transitive)
- Removedlodash.isplainobject@4.0.6(transitive)
- Removedlodash.merge@4.6.2(transitive)
- Removedms@2.0.0(transitive)
- Removedmz@2.7.0(transitive)
- Removednocache@2.1.0(transitive)
- Removednode-uuid@1.4.8(transitive)
- Removedpath-to-regexp@1.9.0(transitive)
- Removedreferrer-policy@1.2.0(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removeduniversalify@2.0.1(transitive)
- Removedx-xss-protection@1.3.0(transitive)
Updated@emartech/json-logger@8.0.2
Updatedapp-root-path@3.1.0
Updatedkoa-helmet@7.0.2
Updatedkoa-pug@5.1.1
Updatedkoa-requestid@2.2.1
Updatedkoa-router@12.0.1
Updatedkoa-static@5.0.0