Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rejoice

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rejoice - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

61

lib/index.js

@@ -1,7 +0,7 @@

// Load modules
'use strict';
var Fs = require('fs');
var Path = require('path');
var Bossy = require('bossy');
var Hoek = require('hoek');
const Fs = require('fs');
const Path = require('path');
const Bossy = require('bossy');
const Hoek = require('hoek');

@@ -11,3 +11,3 @@

var internals = {};
const internals = {};

@@ -38,3 +38,3 @@

var extras = args.require;
const extras = args.require;

@@ -45,11 +45,7 @@ if (!extras) {

var extrasPath;
var nodeModulesPath = Path.join(process.cwd(), 'node_modules');
let extrasPath;
const nodeModulesPath = Path.join(args.p ? Fs.realpathSync(args.p) : process.cwd(), 'node_modules');
if (args.p) {
nodeModulesPath = Path.join(Fs.realpathSync(args.p), 'node_modules');
}
for (var i = 0, il = extras.length; i < il; i++) {
var extra = extras[i];
for (let i = 0; i < extras.length; ++i) {
const extra = extras[i];
if (!Hoek.isAbsolutePath(extra)) {

@@ -80,4 +76,4 @@ if (extra[0] === '.') {

var manifest = null;
var manifestPath = Path.resolve(process.cwd(), args.c);
let manifest;
const manifestPath = Path.resolve(process.cwd(), args.c);

@@ -100,3 +96,3 @@ try {

var options = {};
let options = {};

@@ -107,3 +103,3 @@ if (!args.p) {

Fs.realpath(args.p, function (err, path) {
Fs.realpath(args.p, (err, path) => {

@@ -128,7 +124,6 @@ if (err) {

Object.keys(manifest).forEach(function (key) {
Object.keys(manifest).forEach((key) => {
var value = manifest[key];
if (typeof value === 'string' &&
value.indexOf('$env.') === 0) {
const value = manifest[key];
if (typeof value === 'string' && value.startsWith('$env.')) {

@@ -146,3 +141,3 @@ manifest[key] = process.env[value.slice(5)];

var args = Bossy.parse(internals.definition, {
const args = Bossy.parse(internals.definition, {
argv: options.args

@@ -165,3 +160,3 @@ });

var manifest = internals.getManifest(args);
const manifest = internals.getManifest(args);

@@ -172,5 +167,5 @@ if (manifest instanceof Error) {

internals.loadPacks(args, manifest, function (err, packOptions) {
internals.loadPacks(args, manifest, (err, packOptions) => {
var Glue = require('glue');
const Glue = require('glue');

@@ -182,7 +177,7 @@ if (err) {

Glue.compose(manifest, packOptions, function (err, server) {
Glue.compose(manifest, packOptions, (err, server) => {
Hoek.assert(!err, 'Failed loading plugins: ' + (err && err.message));
server.start(function (err) {
server.start((err) => {

@@ -193,5 +188,5 @@ Hoek.assert(!err, 'Failed starting server: ' + (err && err.message));

process.once('SIGQUIT', function () {
process.once('SIGQUIT', () => {
server.stop(function () {
server.stop(() => {

@@ -204,6 +199,6 @@ process.exit(0);

process.on('SIGUSR2', function () {
process.on('SIGUSR2', () => {
console.log('Stopping...');
server.stop(function () {
server.stop(() => {

@@ -210,0 +205,0 @@ console.log('Starting...');

{
"name": "rejoice",
"description": "hapi.js CLI",
"version": "2.2.1",
"version": "3.0.0",
"repository": "git://github.com/hapijs/rejoice",

@@ -14,13 +14,14 @@ "main": "lib/index.js",

"engines": {
"node": ">=0.10.32"
"node": ">=4"
},
"dependencies": {
"bossy": "2.x.x",
"glue": "2.x.x",
"hoek": "2.x.x"
"glue": "3.x.x",
"hoek": "3.x.x"
},
"devDependencies": {
"catbox-memory": "1.x.x",
"code": "1.x.x",
"lab": "6.x.x"
"catbox-memory": "2.x.x",
"code": "2.x.x",
"hapi": "11.x.x",
"lab": "8.x.x"
},

@@ -27,0 +28,0 @@ "bin": {

@@ -5,3 +5,3 @@ #rejoice

[![Build Status](https://secure.travis-ci.org/hapijs/rejoice.png)](http://travis-ci.org/hapijs/rejoice)
[![Build Status](https://travis-ci.org/hapijs/rejoice.svg)](https://travis-ci.org/hapijs/rejoice)

@@ -56,22 +56,29 @@ Lead Maintainer - [Lloyd Benson](https://github.com/lloydbenson)

},
"plugins": {
"good": {
"opsInterval": 5000,
"requestHeaders": true,
"reporters": [{
"reporter": "good-console",
"events": { "response": "*", "ops": "*", "log": "*", "error": "*" }
},
{
"reporter": "good-file",
"events": { "response": "*", "error": "*" },
"config": "/log/response.log"
},
{
"reporter": "good-file",
"events": { "ops": "*" },
"config": "/log/ops.log"
}]
"registrations": [
{
plugin: {
register: "good",
options: {
"opsInterval": 5000,
"requestHeaders": true,
"reporters": [{
"reporter": "good-console",
"events": { "response": "*", "ops": "*", "log": "*", "error": "*" }
},
{
"reporter": "good-file",
"events": { "response": "*", "error": "*" },
"config": "/log/response.log"
},
{
"reporter": "good-file",
"events": { "ops": "*" },
"config": "/log/ops.log"
}]
}
}
},
"lout": {}
{
plugin: "lout"
}
}

@@ -78,0 +85,0 @@ }

@@ -1,10 +0,10 @@

// Load modules
'use strict';
var ChildProcess = require('child_process');
var Fs = require('fs');
var Os = require('os');
var Path = require('path');
var Code = require('code');
var Hoek = require('hoek');
var Lab = require('lab');
const ChildProcess = require('child_process');
const Fs = require('fs');
const Os = require('os');
const Path = require('path');
const Code = require('code');
const Hoek = require('hoek');
const Lab = require('lab');

@@ -14,3 +14,3 @@

var internals = {};
const internals = {};

@@ -20,13 +20,13 @@

var lab = exports.lab = Lab.script();
var describe = lab.describe;
var it = lab.it;
var expect = Code.expect;
const lab = exports.lab = Lab.script();
const describe = lab.describe;
const it = lab.it;
const expect = Code.expect;
describe('bin/rejoice', function () {
describe('bin/rejoice', () => {
it('composes server with absolute path', function (done) {
it('composes server with absolute path', (done) => {
var manifest = {
const manifest = {
server: {

@@ -52,15 +52,17 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath]);
hapi.stdout.on('data', function (data) {
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath]);
hapi.stdout.on('data', (data) => {

@@ -74,3 +76,3 @@ expect(data.toString()).to.equal('loaded\n');

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -81,5 +83,5 @@ expect(data.toString()).to.not.exist();

it('composes server with absolute path using symlink', { skip: process.platform === 'win32' }, function (done) {
it('composes server with absolute path using symlink', { skip: process.platform === 'win32' }, (done) => {
var manifest = {
const manifest = {
server: {

@@ -104,11 +106,13 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
var symlinkPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
const symlinkPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');

@@ -118,5 +122,5 @@ Fs.symlinkSync(modulePath, symlinkPath, 'dir');

var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', symlinkPath]);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', symlinkPath]);
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -132,3 +136,3 @@ expect(data.toString()).to.equal('loaded\n');

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -139,5 +143,5 @@ expect(data.toString()).to.not.exist();

it('fails when path cannot be resolved', function (done) {
it('fails when path cannot be resolved', (done) => {
var manifest = {
const manifest = {
server: {

@@ -162,15 +166,17 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', 'somethingWrong']);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', 'somethingWrong']);
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -180,3 +186,3 @@ expect(data.toString()).to.not.exist();

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -193,5 +199,5 @@ expect(data.toString()).to.include('ENOENT');

it('errors when it cannot require the extra module', function (done) {
it('errors when it cannot require the extra module', (done) => {
var manifest = {
const manifest = {
server: {

@@ -216,17 +222,19 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var extraPath = 'somecoolmodule';
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const extraPath = 'somecoolmodule';
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -236,3 +244,3 @@ expect(data.toString()).to.not.exist();

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -249,5 +257,5 @@ expect(data.toString()).to.include('Cannot find module');

it('errors when it cannot require the extra module from absolute path', function (done) {
it('errors when it cannot require the extra module from absolute path', (done) => {
var manifest = {
const manifest = {
server: {

@@ -272,17 +280,19 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -292,3 +302,3 @@ expect(data.toString()).to.not.exist();

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -305,5 +315,5 @@ expect(data.toString()).to.include('Cannot find module');

it('loads extra modules as intended', function (done) {
it('loads extra modules as intended', (done) => {
var manifest = {
const manifest = {
server: {

@@ -328,13 +338,15 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var extra = 'console.log(\'test passed\')';
const extra = 'console.log(\'test passed\')';
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');

@@ -344,5 +356,5 @@ Fs.writeFileSync(configPath, JSON.stringify(manifest));

var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath, '--require', extraPath]);
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -358,3 +370,3 @@ expect(data.toString()).to.equal('test passed\n');

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -365,5 +377,5 @@ expect(data.toString()).to.not.exist();

it('loads multiple extra modules as intended', function (done) {
it('loads multiple extra modules as intended', (done) => {
var manifest = {
const manifest = {
server: {

@@ -388,19 +400,21 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var args = [rejoice, '-c', configPath, '-p', modulePath];
const args = [rejoice, '-c', configPath, '-p', modulePath];
var EXTRAS_TO_CREATE = 2;
var extraPaths = [];
for (var i = 0; i < EXTRAS_TO_CREATE; i++) {
var extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const EXTRAS_TO_CREATE = 2;
const extraPaths = [];
for (let i = 0; i < EXTRAS_TO_CREATE; ++i) {
const extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');

@@ -414,6 +428,6 @@ Fs.writeFileSync(extraPath, 'console.log(\'test ' + i + ' passed\')');

var hapi = ChildProcess.spawn('node', args);
var dataCount = 0;
const hapi = ChildProcess.spawn('node', args);
let dataCount = 0;
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -427,4 +441,4 @@ expect(data.toString()).to.equal('test ' + dataCount + ' passed\n');

for (var j = 0; j < EXTRAS_TO_CREATE; j++) {
Fs.unlinkSync(extraPaths[j]);
for (let i = 0; i < EXTRAS_TO_CREATE; ++i) {
Fs.unlinkSync(extraPaths[i]);
}

@@ -436,3 +450,3 @@

hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -443,5 +457,5 @@ expect(data.toString()).to.not.exist();

it('parses $prefixed values as environment variable values', { parallel: false }, function (done) {
it('parses $prefixed values as environment variable values', { parallel: false }, (done) => {
var manifest = {
const manifest = {
server: {

@@ -466,13 +480,18 @@ cache: {

],
plugins: {
'./--options': {
key: '$env.plugin_option'
registrations: [
{
plugin: {
register: './--options',
options: {
key: '$env.plugin_option'
}
}
}
}
]
};
var changes = [];
var setEnv = function (key, value) {
const changes = [];
const setEnv = function (key, value) {
var previous = process.env[key];
const previous = process.env[key];

@@ -496,12 +515,12 @@ if (typeof value === 'undefined') {

var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifest));
var hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath]);
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath]);
hapi.stdout.setEncoding('utf8');
hapi.stdout.on('data', function (data) {
hapi.stdout.on('data', (data) => {

@@ -512,3 +531,3 @@ expect(data).to.equal('app.my: special-value, options.key: plugin-option\n');

var restore = changes.pop();
let restore = changes.pop();
while (restore) {

@@ -523,3 +542,3 @@ restore();

hapi.stderr.setEncoding('utf8');
hapi.stderr.on('data', function (data) {
hapi.stderr.on('data', (data) => {

@@ -526,0 +545,0 @@ expect(data).to.not.exist();

@@ -1,4 +0,4 @@

// Declare internals
'use strict';
var internals = {};
const internals = {};

@@ -5,0 +5,0 @@

@@ -1,4 +0,4 @@

// Declare internals
'use strict';
var internals = {};
const internals = {};

@@ -12,3 +12,3 @@

// be bound to successfully.
plugin.on('start', function () {
plugin.on('start', () => {

@@ -15,0 +15,0 @@ console.log('app.my: %s, options.key: %s', plugin.settings.app.my, options.key);

@@ -1,12 +0,12 @@

// Load modules
'use strict';
var Fs = require('fs');
var Os = require('os');
var Path = require('path');
const Fs = require('fs');
const Os = require('os');
const Path = require('path');
var Code = require('code');
var Glue = require('glue');
var Hoek = require('hoek');
var Lab = require('lab');
var Rejoice = require('..');
const Code = require('code');
const Glue = require('glue');
const Hoek = require('hoek');
const Lab = require('lab');
const Rejoice = require('..');

@@ -16,3 +16,3 @@

var internals = {};
const internals = {};

@@ -22,14 +22,14 @@

var lab = exports.lab = Lab.script();
var describe = lab.describe;
var it = lab.it;
var after = lab.after;
var expect = Code.expect;
const lab = exports.lab = Lab.script();
const describe = lab.describe;
const it = lab.it;
const after = lab.after;
const expect = Code.expect;
describe('start()', function () {
describe('start()', () => {
var consoleLog = console.log;
const consoleLog = console.log;
console.log = Hoek.ignore;
after(function (done) {
after((done) => {

@@ -40,3 +40,3 @@ console.log = consoleLog;

var manifestFile = {
const manifestFile = {
server: {

@@ -56,23 +56,25 @@ cache: {

],
plugins: {
'./--loaded': {}
}
registrations: [
{
plugin: './--loaded'
}
]
};
it('composes server with absolute path', function (done) {
it('composes server with absolute path', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile));
var compose = Glue.compose;
const compose = Glue.compose;
Glue.compose = function (manifest, packOptions, callback) {
expect(manifest.plugins['./--loaded']).to.exist();
expect(manifest.registrations[0].plugin[0]).to.exist();
expect(manifest.server).to.exist();
expect(packOptions.relativeTo).to.be.a.string();
compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -97,8 +99,8 @@ expect(err).to.not.exist();

it('composes server with an extra module', function (done) {
it('composes server with an extra module', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
var extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
var extra = 'console.log(\'test passed\')';
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
const extraPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const extra = 'console.log(\'test passed\')';

@@ -108,7 +110,7 @@ Fs.writeFileSync(configPath, JSON.stringify(manifestFile));

var compose = Glue.compose;
const compose = Glue.compose;
Glue.compose = function (manifest, packOptions, callback) {
expect(manifest.plugins['./--loaded']).to.exist();
expect(manifest.registrations[0].plugin[0]).to.exist();
expect(manifest.server).to.exist();

@@ -119,3 +121,3 @@ expect(packOptions).to.exist();

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -141,12 +143,12 @@ expect(err).to.not.exist();

it('uses the --p option when loading extra modules by name', function (done) {
it('uses the --p option when loading extra modules by name', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile));
var compose = Glue.compose;
var realpathSync = Fs.realpathSync;
var consoleError = console.error;
const compose = Glue.compose;
const realpathSync = Fs.realpathSync;
const consoleError = console.error;

@@ -166,7 +168,7 @@ console.error = function (value) {

expect(manifest.plugins['./--loaded']).to.exist();
expect(manifest.registrations[0].plugin[0]).to.exist();
expect(manifest.server).to.exist();
expect(packOptions).to.exist();
compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -192,12 +194,12 @@ expect(err).to.not.exist();

it('uses the --p option when loading extra modules by relative path', function (done) {
it('uses the --p option when loading extra modules by relative path', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile));
var compose = Glue.compose;
var realpathSync = Fs.realpathSync;
var consoleError = console.error;
const compose = Glue.compose;
const realpathSync = Fs.realpathSync;
const consoleError = console.error;

@@ -217,7 +219,7 @@ console.error = function (value) {

expect(manifest.plugins['./--loaded']).to.exist();
expect(manifest.registrations[0].plugin[0]).to.exist();
expect(manifest.server).to.exist();
expect(packOptions).to.exist();
compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -243,10 +245,10 @@ expect(err).to.not.exist();

it('exits the process if the extra module can not be loaded', function (done) {
it('exits the process if the extra module can not be loaded', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile));
var exit = process.exit;
var consoleError = console.error;
const exit = process.exit;
const consoleError = console.error;

@@ -276,14 +278,14 @@ console.error = function (string, path) {

it('loads a manifest with a relative path', function (done) {
it('loads a manifest with a relative path', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var m = Hoek.clone(manifestFile);
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const m = Hoek.clone(manifestFile);
m.plugins = {};
m.registrations = [];
Fs.writeFileSync(configPath, JSON.stringify(m));
var relativePath = Path.relative(process.cwd(), configPath);
const relativePath = Path.relative(process.cwd(), configPath);
var compose = Glue.compose;
const compose = Glue.compose;

@@ -295,3 +297,3 @@ Glue.compose = function (manifest, packOptions, callback) {

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -316,10 +318,10 @@ expect(err).to.not.exist();

it('exits the process if the manifest file files to parse', function (done) {
it('exits the process if the manifest file files to parse', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile) + ']]');
var exit = process.exit;
var consoleError = console.error;
const exit = process.exit;
const consoleError = console.error;

@@ -348,12 +350,12 @@ console.error = function (value) {

it('will error if there is an error loading packs from -p', function (done) {
it('will error if there is an error loading packs from -p', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(manifestFile));
var realpath = Fs.realpath;
var consoleError = console.error;
var exit = process.exit;
const realpath = Fs.realpath;
const consoleError = console.error;
const exit = process.exit;

@@ -388,5 +390,5 @@ console.error = function (value) {

it('parses $prefixed values as environment variable values', { parallel: false }, function (done) {
it('parses $prefixed values as environment variable values', { parallel: false }, (done) => {
var m = Hoek.clone(manifestFile);
const m = Hoek.clone(manifestFile);

@@ -405,12 +407,17 @@ m.server.app.my = '$env.special_value';

];
m.plugins = {
'./--options': {
key: '$env.plugin_option'
m.registrations = [
{
plugin: {
register: './--options',
options: {
key: '$env.plugin_option'
}
}
}
};
];
var changes = [];
var setEnv = function (key, value) {
const changes = [];
const setEnv = function (key, value) {
var previous = process.env[key];
const previous = process.env[key];

@@ -434,8 +441,8 @@ if (typeof value === 'undefined') {

var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, JSON.stringify(m));
var compose = Glue.compose;
const compose = Glue.compose;

@@ -448,3 +455,3 @@ Glue.compose = function (manifest, packOptions, callback) {

expect(manifest.connections[1].host).to.equal('localhost');
expect(manifest.plugins['./--options']).to.deep.equal({
expect(manifest.registrations[0].plugin.options).to.deep.equal({
key: 'plugin-option'

@@ -456,3 +463,3 @@ });

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -468,3 +475,3 @@ expect(err).to.not.exist();

// Put the env variables back
var restore = changes.pop();
let restore = changes.pop();
while (restore) {

@@ -485,6 +492,6 @@ restore();

it('exits the process if the arguments are invalid', function (done) {
it('exits the process if the arguments are invalid', (done) => {
var consoleError = console.error;
var exit = process.exit;
const consoleError = console.error;
const exit = process.exit;

@@ -510,5 +517,5 @@ console.error = function (value) {

it('prints help with the -h argument', function (done) {
it('prints help with the -h argument', (done) => {
var exit = process.exit;
const exit = process.exit;

@@ -534,11 +541,11 @@ console.log = function (value) {

it('throws an error if there are problems loading the plugins', function (done) {
it('throws an error if there are problems loading the plugins', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
var m = Hoek.clone(manifestFile);
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
const m = Hoek.clone(manifestFile);
Fs.writeFileSync(configPath, JSON.stringify(m));
var compose = Glue.compose;
const compose = Glue.compose;

@@ -550,3 +557,3 @@ Glue.compose = function (manifest, packOptions, callback) {

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -556,3 +563,3 @@ expect(err).to.not.exist();

expect(function () {
expect(() => {

@@ -574,11 +581,11 @@ callback(new Error('mock error'), server);

it('throws an error if there is a problem starting the server', function (done) {
it('throws an error if there is a problem starting the server', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
var m = Hoek.clone(manifestFile);
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
const m = Hoek.clone(manifestFile);
Fs.writeFileSync(configPath, JSON.stringify(m));
var compose = Glue.compose;
const compose = Glue.compose;

@@ -590,3 +597,3 @@ Glue.compose = function (manifest, packOptions, callback) {

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -601,3 +608,3 @@ expect(err).to.not.exist();

expect(function () {
expect(() => {

@@ -619,13 +626,13 @@ cb(new Error('mock error'));

it('kills the process on SIGQUIT and restarts on SIGUSR2', function (done) {
it('kills the process on SIGQUIT and restarts on SIGUSR2', (done) => {
var configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
var modulePath = Path.join(__dirname, 'plugins');
var m = Hoek.clone(manifestFile);
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'json');
const modulePath = Path.join(__dirname, 'plugins');
const m = Hoek.clone(manifestFile);
Fs.writeFileSync(configPath, JSON.stringify(m));
var compose = Glue.compose;
var exit = process.exit;
var start = Rejoice.start;
const compose = Glue.compose;
const exit = process.exit;
const start = Rejoice.start;

@@ -641,3 +648,3 @@ // There are many of these already attached

compose(manifest, packOptions, function (err, server) {
compose(manifest, packOptions, (err, server) => {

@@ -644,0 +651,0 @@ expect(err).to.not.exist();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc