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

describe-loader

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

describe-loader

Wrap root describes with path for __filename

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Describe-loader

describe-loader auto-magically wrap the body of the describe expression in a describe with the path of the file (__filename).

Install | Getting started
  • Install describe-loader npm install --save-dev describe-loader

  • First you need to ensure that __filename is set to true otherwise __filename will always be index.js.

// in webpack.config

node: {
  __filename: true
}
  • Apply loader for .jsx?$ or whatever extension you have
// in webpack.config

module: {
  preLoaders: [{}],
  loaders: [{}],
  postLoaders: [{
    test: /\.jsx?$/,
    include: /src/,
    exclude: /node_modules/,
    loader: 'describe'
  }]
}

The output

before:

var Component = require('component_name.jsx');
var $ = require('jquery');

describe('First describe', function() {
  describe('Deep describe', function() {
    beforeEach(function() {
      // do something
    });

    it('should be ok', function() {
      expect(1).to.equal(1);
    });
  });
});

after:

var Component = require('component_name.jsx');
var $ = require('jquery');

describe('First describe', function() {
  describe('Path ' + __filename, function() {
    describe('Deep describe', function() {
      beforeEach(function() {
        // do something
      });

      it('should be ok', function() {
        expect(1).to.equal(1);
      });
    });
  });
});

Keywords

FAQs

Package last updated on 08 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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