Skip to content

Commit

Permalink
test(licensify): small reproduction case for #17
Browse files Browse the repository at this point in the history
sourcemap generated by babel class
  • Loading branch information
twada committed May 11, 2016
1 parent 43d5a65 commit d0b7d1a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"type-name": "^2.0.0"
},
"devDependencies": {
"babel-plugin-transform-es2015-classes": "^6.8.0",
"babelify": "^7.3.0",
"browserify": "^13.0.0",
"event-stream": "^3.3.1",
"intelli-espower-loader": "^1.0.0",
Expand Down
8 changes: 8 additions & 0 deletions test/test-babel-class/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Entry {
constructor(name) {
this.name = name;
}
toString() {
return this.name;
}
}
6 changes: 6 additions & 0 deletions test/test-babel-class/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "test-babel-class",
"description": "",
"version": "0.1.0",
"license": "MIT"
}
30 changes: 30 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,33 @@ describe('multiple common licenses', function () {
});
});
});


describe('repro case for #17 : sourcemap generated by babel class', function () {
var expectedModules = [
'test-babel-class'
];
describe('sourcemap should be generated', function () {
var header;
before(function (done) {
var save = saveFirstChunk();
var entryPath = path.normalize(path.join(__dirname, 'test-babel-class', 'index.js'));
var b = browserify(entryPath, { debug: true });
b.transform('babelify', {
plugins: ['transform-es2015-classes']
});
b.plugin(licensify);
b.bundle().pipe(save).pipe(es.wait(function(err, data) {
assert(!err);
header = save.firstChunk;
done();
}));
});
expectedModules.forEach(function (moduleName) {
var re = new RegExp(' \* ' + moduleName + '\:$', 'gm');
it('ensure header includes [' + moduleName + ']', function () {
assert(re.test(header));
});
});
});
});

0 comments on commit d0b7d1a

Please sign in to comment.