Skip to content

Commit

Permalink
remove comments by default in babel-preset-babili (#325)
Browse files Browse the repository at this point in the history
* remove comments by default in babel-preset-babili

* tests
  • Loading branch information
hzoo authored and kangax committed Dec 6, 2016
1 parent 4db5dff commit ab98c72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/babel-preset-babili/__tests__/preset-tests.js
Expand Up @@ -39,4 +39,26 @@ describe("preset", () => {
`);
expect(transform(source)).toBe(expected);
});

it("should fix remove comments", () => {
const source = unpad(`
var asdf = 1; // test
`);
const expected = unpad(`
var asdf = 1;
`);
expect(transform(source)).toBe(expected);
});

it("should keep license/preserve annotated comments", () => {
const source = unpad(`
/* @license */
var asdf = 1;
`);
const expected = unpad(`
/* @license */
var asdf = 1;
`);
expect(transform(source)).toBe(expected);
});
});
1 change: 1 addition & 0 deletions packages/babel-preset-babili/src/index.js
Expand Up @@ -107,6 +107,7 @@ function preset(context, _opts = {}) {

return {
minified: true,
comments: false,
presets: [
{ plugins }
],
Expand Down

0 comments on commit ab98c72

Please sign in to comment.