Skip to content

Commit 26ce0ac

Browse files
committed
var -> const/let
1 parent 5204310 commit 26ce0ac

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/shared/utils/__tests__/testMinificationUsedDCE-test.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
*/
1111
'use strict';
1212

13-
var babel = require('babel-core');
14-
var UglifyJs = require('uglify-js');
15-
var testMinificationUsedDCE;
13+
const babel = require('babel-core');
14+
const UglifyJs = require('uglify-js');
15+
let testMinificationUsedDCE;
1616

1717
describe('in the production environment', () => {
1818
let oldProcess;
@@ -49,12 +49,12 @@ describe('in the production environment', () => {
4949
describe('when envified first, then minification with *no* DCE', () => {
5050
it('should throw', () => {
5151
// envify: change `process.env.NODE_ENV` to `"production"`
52-
var rawCode = testMinificationUsedDCE
52+
const rawCode = testMinificationUsedDCE
5353
.toString()
5454
.replace(/process\.env\.NODE_ENV/, '"production"');
55-
var code = {'file.js': rawCode};
56-
var options = {fromString: true, parse: {dead_code: false}};
57-
var result = UglifyJs.minify(code, options);
55+
const code = {'file.js': rawCode};
56+
const options = {fromString: true, parse: {dead_code: false}};
57+
const result = UglifyJs.minify(code, options);
5858
const minifiedWithNoDCE = () => eval('(' + result.code + ')()');
5959
expect(() => {
6060
minifiedWithNoDCE();
@@ -69,12 +69,12 @@ describe('in the production environment', () => {
6969
describe('when envified first, then minified and *yes* successful DCE', () => {
7070
it('should not throw', () => {
7171
// envify: change `process.env.NODE_ENV` to `"production"`
72-
var rawCode = testMinificationUsedDCE
72+
const rawCode = testMinificationUsedDCE
7373
.toString()
7474
.replace(/process\.env\.NODE_ENV/g, '"production"');
75-
var code = {'file.js': rawCode};
76-
var options = {fromString: true, parse: {dead_code: true}};
77-
var result = UglifyJs.minify(code, options);
75+
const code = {'file.js': rawCode};
76+
const options = {fromString: true, parse: {dead_code: true}};
77+
const result = UglifyJs.minify(code, options);
7878
const minifiedWithNoDCE = () => eval('(' + result.code + ')()');
7979
expect(() => {
8080
minifiedWithNoDCE();
@@ -85,11 +85,11 @@ describe('in the production environment', () => {
8585

8686
describe('when minified first with *unsuccessful* DCE, then envified', () => {
8787
it('should throw', () => {
88-
var code = {'file.js': testMinificationUsedDCE.toString()};
89-
var options = {fromString: true, parse: {dead_code: true}};
90-
var result = UglifyJs.minify(code, options);
88+
const code = {'file.js': testMinificationUsedDCE.toString()};
89+
const options = {fromString: true, parse: {dead_code: true}};
90+
const result = UglifyJs.minify(code, options);
9191
// late envify: change `process.env.NODE_ENV` to `"production"`
92-
var resultCode = result.code.replace(
92+
const resultCode = result.code.replace(
9393
/process\.env\.NODE_ENV/g,
9494
'"production"',
9595
);

0 commit comments

Comments
 (0)