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
node: {
__filename: true
}
- Apply loader for
.jsx?$
or whatever extension you have
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() {
});
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() {
});
it('should be ok', function() {
expect(1).to.equal(1);
});
});
});
});