boar-server
Advanced tools
Comparing version
@@ -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" | ||
} |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
42878
0.65%11
-8.33%1011
0.9%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated
Updated