New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hops-bootstrap

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hops-bootstrap - npm Package Compare versions

Comparing version 14.0.0-nightly.4 to 14.0.0-nightly.5

lib/__tests__/fixtures/custom-presets/.hopsrc.json

2

__tests__/fixtures/a-mixin.js
const { callable, override, parallel, pipe, compose } = require('mixinable');
const { Mixin } = require('../..');
const { Mixin } = require('hops-mixin');

@@ -4,0 +4,0 @@ class AMixin extends Mixin {

const { callable, override, parallel, pipe, compose } = require('mixinable');
const { Mixin } = require('../..');
const { Mixin } = require('hops-mixin');

@@ -4,0 +4,0 @@ class AnotherMixin extends Mixin {

const { callable } = require('mixinable');
const { Mixin } = require('../..');
const { Mixin } = require('hops-mixin');

@@ -4,0 +4,0 @@ class ConfigMixin extends Mixin {

@@ -1,2 +0,2 @@

const { Mixin } = require('../..');
const { Mixin } = require('hops-mixin');

@@ -3,0 +3,0 @@ class TestMixin extends Mixin {

const { callable } = require('mixinable');
const {
Mixin,
internal: { validate },
} = require('../..');
const { Mixin } = require('hops-mixin');
const { internal: bootstrap } = require('../..');
const { validate } = bootstrap;
class ValidateMixin extends Mixin {

@@ -8,0 +8,0 @@ validateAndFailArgs() {

@@ -0,15 +1,13 @@

/* eslint-env node, jest */
const { join } = require('path');
// eslint-disable-next-line node/no-missing-require
const test = require('ava');
// eslint-disable-next-line node/no-missing-require
const sinon = require('sinon');
const { initialize } = require('..');
test('Should create a explicitly given mixin', (t) => {
test('Should create a explicitly given mixin', () => {
initialize({ mixins: [join(__dirname, 'fixtures', 'test-mixin')] });
t.truthy(require('./fixtures/test-mixin').mixinCreated);
expect(require('./fixtures/test-mixin').mixinCreated).toBeTruthy();
});
test('Should connect mixins through strategies', (t) => {
test('Should connect mixins through strategies', () => {
const instance = initialize({

@@ -22,6 +20,6 @@ mixins: [

t.is(instance.callFirst(), 'execute callSecond');
expect(instance.callFirst()).toBe('execute callSecond');
});
test('Should support override stategie by order of mixins', (t) => {
test('Should support override stategie by order of mixins', () => {
const instance1 = initialize({

@@ -40,7 +38,7 @@ mixins: [

t.is(instance1.override(), 'from another-mixin');
t.is(instance2.override(), 'from a-mixin');
expect(instance1.override()).toBe('from another-mixin');
expect(instance2.override()).toBe('from a-mixin');
});
test('Should support parallel stategie', (t) => {
test('Should support parallel stategie', () => {
const instance = initialize({

@@ -53,6 +51,6 @@ mixins: [

t.deepEqual(instance.parallel(), ['from a-mixin', 'from another-mixin']);
expect(instance.parallel()).toEqual(['from a-mixin', 'from another-mixin']);
});
test('Should support pipe stategie', (t) => {
test('Should support pipe stategie', () => {
const instance = initialize({

@@ -65,6 +63,6 @@ mixins: [

t.is(instance.pipe(''), 'Hello World');
expect(instance.pipe('')).toBe('Hello World');
});
test('Should support compose stategie', (t) => {
test('Should support compose stategie', () => {
const instance = initialize({

@@ -77,3 +75,3 @@ mixins: [

t.deepEqual(instance.compose({ input: 0 }), {
expect(instance.compose({ input: 0 })).toEqual({
'a-mixin': { 'another-mixin': { input: 0 } },

@@ -83,3 +81,3 @@ });

test('Should allow placeholders in the configuration which are resolved', (t) => {
test('Should allow placeholders in the configuration which are resolved', () => {
const instance = initialize({

@@ -97,12 +95,12 @@ key: 'value',

t.is(config.result1, 'value');
t.is(config.result2, 'value');
expect(config.result1).toBe('value');
expect(config.result2).toBe('value');
});
test('Should allow env-vars in the configuration which are resolved', (t) => {
process.env.UNTOOL_TEST_KEY = 'value';
test('Should allow env-vars in the configuration which are resolved', () => {
process.env.HOPS_TEST_KEY = 'value';
process.env.ENV_KEY_WITH_DEFAULT2 = 'value';
const instance = initialize({
result1: '[UNTOOL_TEST_KEY]',
result1: '[HOPS_TEST_KEY]',
result2: '[ENV_KEY_WITH_DEFAULT1=default-value]',

@@ -115,9 +113,9 @@ result3: '[ENV_KEY_WITH_DEFAULT2=default-value]',

t.is(config.result1, 'value');
t.is(config.result2, 'default-value');
t.is(config.result3, 'value');
expect(config.result1).toBe('value');
expect(config.result2).toBe('default-value');
expect(config.result3).toBe('value');
});
test('Should ignore non-string values when checking for placeholders', (t) => {
const spy = sinon.spy(RegExp.prototype, 'test');
test('Should ignore non-string values when checking for placeholders', () => {
const spy = jest.spyOn(RegExp.prototype, 'test');
const preset = {

@@ -128,3 +126,3 @@ result1: () => '[SOME_ENV_VAR]',

result4: '<result3>',
result5: '[UNTOOL_TEST_KEY]',
result5: '[HOPS_TEST_KEY]',
mixins: [join(__dirname, 'fixtures', 'config-mixin')],

@@ -135,13 +133,13 @@ };

t.is(preset.result1, config.result1);
t.is(preset.result2, config.result2);
t.false(spy.calledWith(preset.result1));
t.false(spy.calledWith(preset.result2));
t.true(spy.calledWith('<result3>'));
t.true(spy.calledWith('[UNTOOL_TEST_KEY]'));
expect(preset.result1).toBe(config.result1);
expect(preset.result2).toBe(config.result2);
expect(spy).not.toHaveBeenCalledWith(preset.result1);
expect(spy).not.toHaveBeenCalledWith(preset.result2);
expect(spy).toHaveBeenCalledWith('<result3>');
expect(spy).toHaveBeenCalledWith('[HOPS_TEST_KEY]');
spy.restore();
spy.mockRestore();
});
test('Should support validate stategie decorator', (t) => {
test('Should support validate stategie decorator', () => {
const instance = initialize({

@@ -151,5 +149,5 @@ mixins: [join(__dirname, 'fixtures', 'validate-mixin')],

t.throws(() => instance.validateAndFailArgs(), 'This is invalid');
t.throws(() => instance.validateAndFailResult(), 'This is invalid');
t.is(instance.validateAndSucceed(), 'Call result');
expect(() => instance.validateAndFailArgs()).toThrow('This is invalid');
expect(() => instance.validateAndFailResult()).toThrow('This is invalid');
expect(instance.validateAndSucceed()).toBe('Call result');
});

@@ -6,2 +6,17 @@ # Change Log

# [14.0.0-nightly.5](https://github.com/xing/hops/compare/v14.0.0-nightly.4...v14.0.0-nightly.5) (2021-01-11)
### Bug Fixes
* **bootstrap:** add Ajv formats ([7a516dc](https://github.com/xing/hops/commit/7a516dc358a6899ff8889eadbe7c43dc1ea47ed9))
* **bootstrap:** limit pattern properties, too ([9e8c045](https://github.com/xing/hops/commit/9e8c0457d19d0c697f61d55948709ad52c98d946))
* **bootstrap:** opt out of Ajv's strict mode ([28b429b](https://github.com/xing/hops/commit/28b429b228f3205831cdf6d85500fb58b8874bef))
* **bootstrap:** use default import of Ajv ([49fa6e9](https://github.com/xing/hops/commit/49fa6e98938e0c1e52c872bef9a3289a28e5ced8))
* update dependency ajv to v7 ([b2cac42](https://github.com/xing/hops/commit/b2cac42847dc9b5b110dc8eff0eb7499c9fc2b04))
# [14.0.0-nightly.4](https://github.com/xing/hops/compare/v14.0.0-nightly.3...v14.0.0-nightly.4) (2020-12-07)

@@ -8,0 +23,0 @@

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

const { resolve } = require('path');
const { loadConfig } = require('../../../loader');
console.log(JSON.stringify(loadConfig('namespace', {}, '.')));
console.log(JSON.stringify(loadConfig({}, resolve('.'))));

@@ -0,5 +1,6 @@

const { resolve } = require('path');
const { loadConfig } = require('../../../loader');
console.log(
JSON.stringify(loadConfig('namespace', { dependencies: { foo: '*' } }, '.'))
JSON.stringify(loadConfig({ dependencies: { foo: '*' } }, resolve('.')))
);

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

const { resolve } = require('path');
const { loadConfig } = require('../../../loader');
console.log(JSON.stringify(loadConfig('namespace', {}, '.')));
console.log(JSON.stringify(loadConfig({}, resolve('.'))));

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

const { resolve } = require('path');
const { loadConfig } = require('../../../loader');
console.log(JSON.stringify(loadConfig('namespace', {}, '.')));
console.log(JSON.stringify(loadConfig({}, resolve('.'))));

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

/* eslint-env node, jest */
const { join } = require('path');
// eslint-disable-next-line node/no-missing-require
const test = require('ava');
// eslint-disable-next-line node/no-extraneous-require

@@ -20,34 +19,24 @@ const execa = require('execa');

test('Should return empty object if no config is given', async (t) => {
test('Should return empty object if no config is given', async () => {
const actual = await spawnTest('no-config');
t.deepEqual({}, actual);
expect(actual).toEqual({});
});
test('Should return a simple config without presets', async (t) => {
test('Should return a simple config without presets', async () => {
const actual = await spawnTest('no-presets');
t.deepEqual({ key: 'value' }, actual);
expect(actual).toEqual({ key: 'value' });
});
test('Should return a config with default presets', async (t) => {
test('Should return a config with default presets', async () => {
const actual = await spawnTest('default-presets');
t.deepEqual(
{
key: 'value',
},
actual
);
expect(actual).toEqual({ key: 'value' });
});
test('Should return a config with custom presets', async (t) => {
test('Should return a config with custom presets', async () => {
const actual = await spawnTest('custom-presets');
t.deepEqual(
{
key: 'value',
},
actual
);
expect(actual).toEqual({ key: 'value' });
});

@@ -7,7 +7,10 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_" }] */

const Ajv = require('ajv');
const { default: Ajv } = require('ajv');
const { default: addFormats } = require('ajv-formats');
const isPlainObject = require('is-plain-obj');
const configureAjv = (ajv) => {
ajv.addKeyword('absolutePath', {
addFormats(ajv);
ajv.addKeyword({
keyword: 'absolutePath',
errors: true,

@@ -36,3 +39,4 @@ type: 'string',

});
ajv.addKeyword('isFunction', {
ajv.addKeyword({
keyword: 'isFunction',
compile(expected, schema) {

@@ -64,3 +68,7 @@ const callback = (data) => {

exports.validate = (config, properties) => {
const ajv = new Ajv({ allErrors: true });
const ajv = new Ajv({
allErrors: true,
allowMatchingProperties: true,
strict: false,
});
const additional = {

@@ -67,0 +75,0 @@ patternProperties: {

{
"name": "hops-bootstrap",
"version": "14.0.0-nightly.4",
"version": "14.0.0-nightly.5",
"description": "Hops bootstrap",

@@ -15,3 +15,4 @@ "repository": {

"dependencies": {
"ajv": "^6.10.2",
"ajv": "^7.0.0",
"ajv-formats": "^1.5.1",
"check-error": "^1.0.2",

@@ -33,3 +34,8 @@ "cosmiconfig": "^7.0.0",

},
"gitHead": "92be19e7a93f99b437ed2c33f0637881632d9728"
"jest": {
"testPathIgnorePatterns": [
"fixtures"
]
},
"gitHead": "24bd3f51b4ef1f0f4e0d41a07443928d1c87d6b4"
}

@@ -234,1 +234,8 @@ # `hops-bootstrap`

You will only ever have to call it if you want to use `hops-bootstrap` programmatically. You can pass it an `configOverrides` object that will be merged into the main config object, and an options object mixins might use instead of CLI arguments.
## Debugging
Available tags for the [`debug`](https://www.npmjs.com/package/debug)-module are:
- `hops:bootstrap`
- `hops:config`
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