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

@regru/bem-loader

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@regru/bem-loader - npm Package Compare versions

Comparing version 1.0.1 to 1.1.1

4

index.js

@@ -41,4 +41,6 @@ const loaderUtils = require('loader-utils');

if ( typeof err === 'string' ) {
this.emitWarning( err );
const emitMethod = options.strict ? 'emitError' : 'emitWarning';
this[emitMethod]( err );
return void next( null );

@@ -45,0 +47,0 @@ }

@@ -34,6 +34,8 @@ const { promisify } = require('util');

const emitMethod = options.strict ? 'emitError' : 'emitWarning';
return Bluebird.filter( promises, res => res )
.spread( function( directory ) {
if ( !directory ) {
context.emitWarning( `Entity ${block.toString()} not found` );
context[emitMethod]( `Entity ${block.toString()} not found` );

@@ -47,3 +49,3 @@ return [];

if ( !matches.length ) {
context.emitWarning( `No files found for ${block.toString()}` );
context[emitMethod]( `No files found for ${block.toString()}` );

@@ -50,0 +52,0 @@ return [];

{
"name": "@regru/bem-loader",
"version": "1.0.1",
"version": "1.1.1",
"description": "Webpack loader for BEM projects",

@@ -15,4 +15,5 @@ "homepage": "https://github.com/shifteee/bem-loader.git",

"chai": "^3.5.0",
"chai-as-promised": "7.1.1",
"eslint": "^4.19.1",
"mocha": "^3.2.0",
"mocha": "6.2.2",
"sinon": "^1.17.6"

@@ -19,0 +20,0 @@ },

@@ -28,3 +28,4 @@ Bem-loader

elemDelim: '__' // optional, default '__'
modDelim: '_' //optional, default '_'
modDelim: '_' //optional, default '_',
strict: false //optional, default false. throws if no files is found
},

@@ -31,0 +32,0 @@ ```

const path = require('path');
const search = require('../libs/search');
const expect = require('chai').expect;
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const sinon = require('sinon');
const expect = chai.expect;
chai.use( chaiAsPromised );
const block = {

@@ -23,10 +27,12 @@ block : 'b-block-two',

emitWarning() {},
emitError() {},
};
describe( 'search', function() {
let spy;
let warningSpy;
let errorSpy;
beforeEach( function() {
spy = sinon.spy( context , 'emitWarning' );
warningSpy = sinon.spy( context , 'emitWarning' );
errorSpy = sinon.spy( context , 'emitError' );
} );

@@ -36,2 +42,3 @@

context.emitWarning.restore();
context.emitError.restore();
} );

@@ -42,6 +49,15 @@

.then( function() {
expect( spy.called ).to.be.true;
expect( warningSpy.called ).to.be.true;
} );
} );
it( 'should emit error if found nothing and options.strict == true', function() {
return search( context, { block: 'nonexistent' }, {
levels,
strict : true,
} ).then( function() {
expect( errorSpy.called ).to.be.true;
} );
} );
it( 'should throw exception if levels not set', function() {

@@ -48,0 +64,0 @@ expect( () => search( context, block ) ).to.throw();

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