Skip to content

Commit e73cbf3

Browse files
committed
move rest of requireJsStuffPlugin to es6
1 parent 2e6292a commit e73cbf3

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

test/RequireJsStuffPlugin.test.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
var should = require("should");
2-
var sinon = require("sinon");
3-
var RequireJsStuffPlugin = require("../lib/RequireJsStuffPlugin");
4-
var applyPluginWithOptions = require("./helpers/applyPluginWithOptions");
5-
var PluginEnvironment = require("./helpers/PluginEnvironment");
1+
"use strict";
2+
const should = require("should");
3+
const sinon = require("sinon");
4+
const RequireJsStuffPlugin = require("../lib/RequireJsStuffPlugin");
5+
const applyPluginWithOptions = require("./helpers/applyPluginWithOptions");
6+
const PluginEnvironment = require("./helpers/PluginEnvironment");
67

78
describe("RequireJsStuffPlugin", function() {
89
it("has apply function", function() {
910
(new RequireJsStuffPlugin()).apply.should.be.a.Function();
1011
});
1112

1213
describe("when applied", function() {
13-
var eventBindings, eventBinding;
14+
let eventBindings;
15+
let eventBinding;
1416

1517
beforeEach(function() {
1618
eventBindings = applyPluginWithOptions(RequireJsStuffPlugin);
@@ -30,7 +32,9 @@ describe("RequireJsStuffPlugin", function() {
3032
});
3133

3234
describe('when called', function() {
33-
var pluginEnvironment, compilationEventBindings, compilation;
35+
let pluginEnvironment;
36+
let compilationEventBindings;
37+
let compilation;
3438

3539
beforeEach(function() {
3640
pluginEnvironment = new PluginEnvironment();
@@ -42,7 +46,7 @@ describe("RequireJsStuffPlugin", function() {
4246
set: sinon.spy()
4347
}
4448
};
45-
var params = {
49+
const params = {
4650
normalModuleFactory: pluginEnvironment.getEnvironmentStub()
4751
};
4852
eventBinding.handler(compilation, params);
@@ -90,7 +94,9 @@ describe("RequireJsStuffPlugin", function() {
9094
});
9195

9296
describe('when called with empty parser options', function() {
93-
var parserEventBinding, parserEventContext, expressionMock;
97+
let parserEventBinding;
98+
let parserEventContext;
99+
let expressionMock;
94100

95101
beforeEach(function() {
96102
parserEventContext = {
@@ -150,8 +156,8 @@ describe("RequireJsStuffPlugin", function() {
150156
});
151157

152158
it('adds dependency to current state', function() {
153-
var addDependencySpy = parserEventContext.state.current.addDependency;
154-
var addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
159+
const addDependencySpy = parserEventContext.state.current.addDependency;
160+
const addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
155161
addDependencySpy.callCount.should.be.exactly(1);
156162
addedDependency.should.be.exactly('{"module":null,"expression":";","range":10,"loc":5}');
157163
});
@@ -173,8 +179,8 @@ describe("RequireJsStuffPlugin", function() {
173179
});
174180

175181
it('adds dependency to current state', function() {
176-
var addDependencySpy = parserEventContext.state.current.addDependency;
177-
var addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
182+
const addDependencySpy = parserEventContext.state.current.addDependency;
183+
const addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
178184
addDependencySpy.callCount.should.be.exactly(1);
179185
addedDependency.should.be.exactly('{"module":null,"expression":"\\"0.0.0\\"","range":10,"loc":5}');
180186
});
@@ -196,8 +202,8 @@ describe("RequireJsStuffPlugin", function() {
196202
});
197203

198204
it('adds dependency to current state', function() {
199-
var addDependencySpy = parserEventContext.state.current.addDependency;
200-
var addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
205+
const addDependencySpy = parserEventContext.state.current.addDependency;
206+
const addedDependency = JSON.stringify(addDependencySpy.getCall(0).args[0]);
201207
addDependencySpy.callCount.should.be.exactly(1);
202208
addedDependency.should.be.exactly('{"module":null,"expression":"\\"__webpack_require__.oe\\"","range":10,"loc":5}');
203209
});

0 commit comments

Comments
 (0)