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

awilix

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awilix - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

test/integration/syntax-errors/index.js

16

lib/createContainer.js
'use strict';
const requireStack = require('require-stack');
const loadModules = require('./loadModules');

@@ -10,6 +11,7 @@ const listModules = require('./listModules');

* Creates an Awilix container instance.
*
* @param {Function} options.require The require function to use. Defaults to require-stack.
* @return {AwilixContainer} The container.
*/
module.exports = function createContainer() {
module.exports = function createContainer(options) {
options = options || {};
const container = {

@@ -27,3 +29,3 @@ /**

const _loadModulesDeps = {
require: require,
require: options.require || requireStack,
listModules: listModules,

@@ -117,7 +119,5 @@ container: container

container.loadModules = (globPatterns, opts) => {
return loadModules(_loadModulesDeps, globPatterns, opts).then(result => {
return resolveTokens(container).then(() => {
return result;
});
});
return loadModules(_loadModulesDeps, globPatterns, opts).then(result =>
resolveTokens(container).then(() => result)
);
};

@@ -124,0 +124,0 @@

{
"name": "awilix",
"version": "0.1.1",
"version": "0.2.0",
"description": "Simple dependency injection container + helper utilities to facilitate wiring of modules",

@@ -37,4 +37,4 @@ "main": "lib/awilix.js",

"coveralls": "^2.11.6",
"eslint": "^2.2.0",
"eslint-watch": "^2.1.7",
"eslint": "^2.4.0",
"eslint-watch": "^2.1.10",
"istanbul": "^0.4.2",

@@ -46,4 +46,5 @@ "mocha": "^2.4.5",

"dependencies": {
"glob": "^7.0.0"
"glob": "^7.0.0",
"require-stack": "^1.0.1"
}
}

@@ -6,4 +6,2 @@ 'use strict';

module.exports = function () {
console.log(__dirname);
const container = awilix.createContainer();

@@ -10,0 +8,0 @@ return container.loadModules([

@@ -6,2 +6,3 @@ 'use strict';

const fixture = require('./fixture');
const syntaxErrors = require('./syntax-errors');

@@ -23,2 +24,9 @@ describe('integration tests', function() {

});
it('emits nice syntax errors', function() {
const success = sinon.spy();
return syntaxErrors().then(success, (err) => {
err.toString().should.contain('errorService.js:2');
});
});
});

@@ -11,2 +11,10 @@ 'use strict';

it('uses the passed require function for loadModules', function() {
const requireSpy = sinon.spy();
const container = createContainer({ require: requireSpy });
return container.loadModules(['lib/*.js']).then((r) => {
requireSpy.should.have.been.called;
});
});
describe('bind', function() {

@@ -13,0 +21,0 @@ it('returns a bound method taking the container as the first parameter', function() {

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