Skip to content

Commit

Permalink
var -> const/let
Browse files Browse the repository at this point in the history
  • Loading branch information
flarnie committed Aug 14, 2017
1 parent 5204310 commit 26ce0ac
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/shared/utils/__tests__/testMinificationUsedDCE-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/
'use strict';

var babel = require('babel-core');
var UglifyJs = require('uglify-js');
var testMinificationUsedDCE;
const babel = require('babel-core');
const UglifyJs = require('uglify-js');
let testMinificationUsedDCE;

describe('in the production environment', () => {
let oldProcess;
Expand Down Expand Up @@ -49,12 +49,12 @@ describe('in the production environment', () => {
describe('when envified first, then minification with *no* DCE', () => {
it('should throw', () => {
// envify: change `process.env.NODE_ENV` to `"production"`
var rawCode = testMinificationUsedDCE
const rawCode = testMinificationUsedDCE
.toString()
.replace(/process\.env\.NODE_ENV/, '"production"');
var code = {'file.js': rawCode};
var options = {fromString: true, parse: {dead_code: false}};
var result = UglifyJs.minify(code, options);
const code = {'file.js': rawCode};
const options = {fromString: true, parse: {dead_code: false}};
const result = UglifyJs.minify(code, options);
const minifiedWithNoDCE = () => eval('(' + result.code + ')()');
expect(() => {
minifiedWithNoDCE();
Expand All @@ -69,12 +69,12 @@ describe('in the production environment', () => {
describe('when envified first, then minified and *yes* successful DCE', () => {
it('should not throw', () => {
// envify: change `process.env.NODE_ENV` to `"production"`
var rawCode = testMinificationUsedDCE
const rawCode = testMinificationUsedDCE
.toString()
.replace(/process\.env\.NODE_ENV/g, '"production"');
var code = {'file.js': rawCode};
var options = {fromString: true, parse: {dead_code: true}};
var result = UglifyJs.minify(code, options);
const code = {'file.js': rawCode};
const options = {fromString: true, parse: {dead_code: true}};
const result = UglifyJs.minify(code, options);
const minifiedWithNoDCE = () => eval('(' + result.code + ')()');
expect(() => {
minifiedWithNoDCE();
Expand All @@ -85,11 +85,11 @@ describe('in the production environment', () => {

describe('when minified first with *unsuccessful* DCE, then envified', () => {
it('should throw', () => {
var code = {'file.js': testMinificationUsedDCE.toString()};
var options = {fromString: true, parse: {dead_code: true}};
var result = UglifyJs.minify(code, options);
const code = {'file.js': testMinificationUsedDCE.toString()};
const options = {fromString: true, parse: {dead_code: true}};
const result = UglifyJs.minify(code, options);
// late envify: change `process.env.NODE_ENV` to `"production"`
var resultCode = result.code.replace(
const resultCode = result.code.replace(
/process\.env\.NODE_ENV/g,
'"production"',
);
Expand Down

0 comments on commit 26ce0ac

Please sign in to comment.