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

@hkube/config

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hkube/config - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

tests/config/logger/config.syntax.js

26

.eslintrc.js

@@ -13,24 +13,28 @@ module.exports = {

"sourceType": "module",
"ecmaVersion": 2017
"ecmaVersion": 2020
},
"rules": {
"no-param-reassign":"off",
"no-param-reassign": "error",
"prefer-template": "error",
"no-trailing-spaces": "error",
"no-console": "error",
"no-use-before-define": "warn",
"object-curly-spacing": "error",
"no-var": "error",
"import/newline-after-import": "off",
"max-len": ["error", 220],
"brace-style": ["error", "stroustrup"],
"indent": ["warn", 4],
"prefer-template": "off",
"comma-dangle": "off",
"no-underscore-dangle": "off",
"max-len": ["error", 200],
"brace-style": ["error", "stroustrup"],
"no-trailing-spaces": "off",
"no-console": "error",
"linebreake-style": "off",
"no-var": "error",
"object-curly-spacing": "off",
"object-curly-newline": "off",
"newline-per-chained-call": "off",
"arrow-body-style": "off",
"class-methods-use-this":"off",
"class-methods-use-this": "off",
"no-unused-expressions": 0,
"chai-friendly/no-unused-expressions": 2
"arrow-parens": "off",
"import/no-dynamic-require": "off",
"global-require": "off"
}
};

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

module.exports = require('./lib/config');

@@ -16,4 +16,4 @@ const fs = require('fs');

load(options) {
options = options || {};
load(option) {
const options = option || {};
options.configFolder = options.configFolder || '';

@@ -35,10 +35,15 @@ const dir = options.cwd || process.cwd();

_requireConfigFile(dir, configFolder, configName) {
const configEnvironment = path.join(configFolder, 'config.' + configName + '.js');
const configEnvironment = path.join(configFolder, `config.${configName}.js`);
try {
return require(path.join(dir, configEnvironment)); // eslint-disable-line global-require, import/no-dynamic-require
const file = path.join(dir, configEnvironment);
if (!fs.existsSync(file)) {
throw new Error(`unable to find file ${configEnvironment}`);
}
return require(file);
}
catch (error) {
throw new Error(`Unable to load config file for environment ${configName} at folder ${dir}/${configFolder}. The missing file is ${configEnvironment}`);
catch (e) {
throw new Error(`unable to load config file for environment ${configName} at folder ${dir}/${configFolder}. ${e.message}`);
}
}
_readConfigFromDisk(options) {

@@ -45,0 +50,0 @@ const dir = options.cwd || process.cwd();

{
"name": "@hkube/config",
"version": "2.0.10",
"version": "2.0.11",
"description": "configuration management for nodejs",

@@ -18,8 +18,8 @@ "main": "index.js",

"coveralls": "^3.0.0",
"eslint": "^4.15.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-import": "^2.8.0",
"istanbul": "^1.1.0-alpha.1",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-chai-friendly": "^0.6.0",
"eslint-plugin-import": "^2.22.1",
"mocha": "^4.1.0",
"nyc": "^15.1.0",
"pre-commit": "^1.2.2",

@@ -29,6 +29,7 @@ "sinon": "^4.1.3"

"scripts": {
"test": "mocha tests --colors --recursive --exit",
"test-travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec tests --exit && npm run lint",
"build": "npm publish",
"lint": "./node_modules/eslint/bin/eslint.js ."
"lint": "./node_modules/eslint/bin/eslint.js .",
"test": "./node_modules/mocha/bin/_mocha tests/tests.js --colors --recursive --exit",
"test:cov": "./node_modules/nyc/bin/nyc.js --reporter=html --reporter=text --reporter=lcov npm run test",
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"build": "npm publish"
},

@@ -35,0 +36,0 @@ "repository": {

@@ -16,22 +16,23 @@ const chai = require("chai");

done();
});
it('should throw if env is not found in logger', function (done) {
configIt._env='notExist';
const configTest = ()=> configIt.load({ useBase: true, configFolder: 'tests' });
expect(configTest).to.throw(`Unable to load config file for environment notExist at folder ${process.cwd()}/tests/config/logger. The missing file is tests/config/logger/config.notExist.js`)
configIt._env = 'notExist';
const configTest = () => configIt.load({ useBase: true, configFolder: 'tests' });
expect(configTest).to.throw()
done();
});
it('should throw if env is not found in main', function (done) {
configIt._env='onlyLogger';
const configTest = ()=> configIt.load({ useBase: true, configFolder: 'tests' });
expect(configTest).to.throw(`Unable to load config file for environment onlyLogger at folder ${process.cwd()}/tests/config/main. The missing file is tests/config/main/config.onlyLogger.js`)
configIt._env = 'onlyLogger';
const configTest = () => configIt.load({ useBase: true, configFolder: 'tests' });
expect(configTest).to.throw()
done();
});
it('should get env',()=>{
configIt._env='myEnv';
it('should throw if env is not found in logger', function (done) {
configIt._env = 'syntax';
const configTest = () => configIt.load({ useBase: true, configFolder: 'tests' });
expect(configTest).to.throw()
done();
});
it('should get env', () => {
configIt._env = 'myEnv';
expect(configIt.env()).to.eql('myEnv')

@@ -38,0 +39,0 @@ })

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