From 181476c79458ecd0f4a0a976b250edfaf9d81c4b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Aug 2016 07:34:11 -0400 Subject: [PATCH 1/4] Update jest, add test updates from babel/babel --- package.json | 8 +++---- .../__tests__/remove-console-test.js | 21 ++++++++++++++++++ .../__tests__/remove-debugger-test.js | 22 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 595c21f8e..681fccc11 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "jest": { "scriptPreprocessor": "/node_modules/babel-jest", "testEnvironment": "node", - "testPathPattern": [ - "src" + "testPathDirs": [ + "packages" ], "preprocessorIgnorePatterns": [ "/node_modules/" @@ -32,7 +32,7 @@ }, "devDependencies": { "babel-cli": "^6.4.0", - "babel-jest": "^10.0.2", + "babel-jest": "^14.1.0", "babel-plugin-transform-es2015-block-scoping": "^6.10.1", "babel-preset-es2015": "^6.3.13", "babel-traverse": "^6.10.4", @@ -46,7 +46,7 @@ "gulp-babel": "^6.1.2", "gulp-newer": "^1.1.0", "gulp-util": "^3.0.7", - "jest-cli": "^12.1.1", + "jest-cli": "^14.1.0", "lerna": "2.0.0-beta.24", "through2": "^2.0.1", "uglify-js": "^2.6.2" diff --git a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js index 0714f2c67..02337e4db 100644 --- a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js +++ b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js @@ -68,4 +68,25 @@ describe("remove-console-plugin", () => { `); expect(transform(source).trim()).toBe(expected); }); + + it("statement no block", () => { + const source = unpad(` + if (blah) console.log(blah); + for (;;) console.log(blah); + for (var blah in []) console.log(blah); + for (var blah of []) console.log(blah); + while (blah) console.log(blah); + do console.log(blah); while (blah); + `); + + const expected = unpad(` + if (blah) {} + for (;;) {} + for (var blah in []) {} + for (var blah of []) {} + while (blah) {} + do {} while (blah); + `); + expect(transform(source).trim()).toBe(expected); + }); }); diff --git a/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js b/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js index ec401f019..46e275f2c 100644 --- a/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js +++ b/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js @@ -2,6 +2,7 @@ jest.autoMockOff(); const babel = require("babel-core"); const plugin = require("../src/index"); +const unpad = require("../../../utils/unpad"); function transform(code) { return babel.transform(code, { @@ -21,4 +22,25 @@ describe("remove-debugger-plugin", () => { const expected = "1;"; expect(transform(source)).toBe(expected); }); + + it("statement no block", () => { + const source = unpad(` + if (blah) debugger; + for (;;) debugger; + for (var blah in []) debugger; + for (var blah of []) debugger; + while (blah) debugger; + do debugger; while (blah); + `); + + const expected = unpad(` + if (blah) {} + for (;;) {} + for (var blah in []) {} + for (var blah of []) {} + while (blah) {} + do {} while (blah); + `); + expect(transform(source).trim()).toBe(expected); + }); }); From 916e3148123ccf6253495e1cdaa0381ef15f8e0a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Aug 2016 07:35:05 -0400 Subject: [PATCH 2/4] update to eslint 3.x and use ^ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 681fccc11..9d2276cd2 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "chalk": "^1.1.3", "cli-table": "^0.3.1", "closure-compiler": "^0.2.12", - "eslint": "^2.7.0", + "eslint": "~3.0.0", "eslint-config-babel": "^1.0.0", "gulp": "gulpjs/gulp#4.0", "gulp-babel": "^6.1.2", From 6aadd57e2d37debcbce00c948780087407a728cb Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Aug 2016 07:38:57 -0400 Subject: [PATCH 3/4] move top level dep to devDeps, make lodash a dependency --- package.json | 6 +----- .../babel-plugin-minify-dead-code-elimination/package.json | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 9d2276cd2..71792355a 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,8 @@ "/node_modules/" ] }, - "dependencies": { - "babel-core": "^6.4.5", - "babel-traverse": "^6.3.26", - "lodash": "^4.13.1" - }, "devDependencies": { + "babel-core": "^6.4.5", "babel-cli": "^6.4.0", "babel-jest": "^14.1.0", "babel-plugin-transform-es2015-block-scoping": "^6.10.1", diff --git a/packages/babel-plugin-minify-dead-code-elimination/package.json b/packages/babel-plugin-minify-dead-code-elimination/package.json index 1aaeb147b..daec7389e 100644 --- a/packages/babel-plugin-minify-dead-code-elimination/package.json +++ b/packages/babel-plugin-minify-dead-code-elimination/package.json @@ -12,7 +12,8 @@ "babel-plugin" ], "dependencies": { - "babel-helper-remove-or-void": "^0.0.0" + "babel-helper-remove-or-void": "^0.0.0", + "lodash": "^4.14.1" }, "devDependencies": {} } From 5cdfdb6c6b2d32f49349b105fec183716cd43402 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Aug 2016 09:34:59 -0400 Subject: [PATCH 4/4] remove babel-cli, using gulp-babel --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 71792355a..da0f8b30f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ }, "devDependencies": { "babel-core": "^6.4.5", - "babel-cli": "^6.4.0", "babel-jest": "^14.1.0", "babel-plugin-transform-es2015-block-scoping": "^6.10.1", "babel-preset-es2015": "^6.3.13",