1.4.1 • Published 9 years ago

describe-loader v1.4.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

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);
      });
    });
  });
});
1.4.1

9 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago