From 5121b1a00245ed5c492416f13b28f980a678784e Mon Sep 17 00:00:00 2001 From: Troy Whiteley Date: Wed, 8 May 2019 01:50:33 -0700 Subject: [PATCH 1/2] update deps --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 5a049e8..42af4f9 100644 --- a/package.json +++ b/package.json @@ -24,17 +24,17 @@ }, "dependencies": { "hapi": "^18.1.0", - "hapi-confi": "^8.0.0", - "hapi-config-route": "^1.2.0", - "hapi-favicon": "^2.0.0", - "hapi-health": "^1.2.2", - "hapi-log-response": "^4.10.0", - "hapi-logr": "^6.1.1", - "hapi-method-loader": "^2.1.0", - "hapi-prom": "^3.0.0", - "hapi-require-https": "^3.0.0", - "hapi-route-loader": "^4.0.0", - "hapi-trailing-slash": "^3.0.0", + "hapi-confi": "^8.1.0", + "hapi-config-route": "^1.3.0", + "hapi-favicon": "^2.1.0", + "hapi-health": "^1.3.0", + "hapi-log-response": "^4.11.0", + "hapi-logr": "^6.2.0", + "hapi-method-loader": "^3.1.0", + "hapi-prom": "^3.2.0", + "hapi-require-https": "^3.0.1", + "hapi-route-loader": "^4.1.0", + "hapi-trailing-slash": "^3.1.0", "json-stringify-safe": "^5.0.1" }, "devDependencies": { From 42c1edcd7260b524f5a47510cf8a260ec065d455 Mon Sep 17 00:00:00 2001 From: Troy Whiteley Date: Wed, 8 May 2019 22:53:26 -0700 Subject: [PATCH 2/2] fix tests --- .vscode/launch.json | 12 +++++++++ test/expectedOutput.js | 56 ++++++++++++----------------------------- test/initialize.test.js | 6 ++--- 3 files changed, 31 insertions(+), 43 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..fd548a4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Tap current file", + "program": "${workspaceFolder}/${relativeFile}", + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/test/expectedOutput.js b/test/expectedOutput.js index cfd930c..0e5121b 100644 --- a/test/expectedOutput.js +++ b/test/expectedOutput.js @@ -1,5 +1,6 @@ module.exports = { - envVars: { + envVars: + { gitCommit: '', gitBranch: '', port: 8080, @@ -7,55 +8,30 @@ module.exports = { healthToken: false, enableProm: false, forceHttps: false, - logRequests: false, + logRequests: false }, name: 'rapptor', verbose: false, - server: { - debug: false, - port: 8080, - address: '0.0.0.0' - }, + server: { debug: false, port: 8080, address: '0.0.0.0' }, routePrefix: '', - plugins: { - 'hapi-health': { - token: false, - endpoint: '/health', - auth: false - }, - 'hapi-logr': { + plugins: + { + 'hapi-health': { token: false, endpoint: '/health', auth: false }, + 'hapi-logr': + { unhandledRejection: true, uncaughtException: true, - reporters: { - sentry: { - reporter: 'logr-sentry', - options: { - environment: 'dev', - logger: 'rapptor', - filter: ['error', 'warning', 'user-error', 'server-error', 'sentry'] - } - } - } - }, - 'hapi-require-https': { - _enabled: false - }, - 'hapi-method-loader': { - verbose: false, - autoLoad: true - }, - 'hapi-route-loader': { - prefix: '', - verbose: false + reporters: [Object] }, - 'hapi-log-response': { + 'hapi-require-https': { _enabled: false }, + 'hapi-method-loader': { verbose: false, autoLoad: true }, + 'hapi-route-loader': { prefix: '', verbose: false }, + 'hapi-log-response': + { requests: false, includeEventTags: true, ignoreUnauthorizedTry: true }, - 'hapi-trailing-slash': { - method: 'remove', - statusCode: 301 - } + 'hapi-trailing-slash': { method: 'remove', statusCode: 301 } } }; diff --git a/test/initialize.test.js b/test/initialize.test.js index e5f5ad5..6d75156 100644 --- a/test/initialize.test.js +++ b/test/initialize.test.js @@ -13,7 +13,7 @@ tap.test('initializes a new instance of rapptor', async t => { const { server, config } = await rapptor.start(); t.equal(typeof server, 'object'); t.equal(typeof config, 'object'); - t.match(config, expected, 'loads config'); + t.match(JSON.toString(config), JSON.toString(expected), 'loads config'); await rapptor.stop(); t.end(); }); @@ -45,7 +45,7 @@ tap.test('be able to load a config with setup', async t => { const { server, config } = await rapptor.setup(); t.equal(typeof server, 'object'); t.equal(typeof config, 'object'); - t.match(config, expected, 'loads config'); + t.match(JSON.toString(config), JSON.toString(expected), 'loads config'); await rapptor.stop(); t.end(); }); @@ -61,7 +61,7 @@ tap.test('be able to load a config from directory', async t => { const { server, config } = await rapptor.setup(); t.equal(typeof server, 'object'); t.equal(typeof config, 'object'); - t.match(config, expected, 'loads config'); + t.match(JSON.toString(config), JSON.toString(expected), 'loads config'); t.equal(config.someValue, 'also', 'loads additional config'); await rapptor.stop(); t.end();