1+ /* globals describe, beforeEach, it */
12"use strict" ;
23
3- const should = require ( "should" ) ;
4+ require ( "should" ) ;
45const sinon = require ( "sinon" ) ;
56const WebWorkerMainTemplatePlugin = require ( "../lib/webworker/WebWorkerMainTemplatePlugin" ) ;
67const applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
@@ -15,40 +16,40 @@ const createMockChunk = (ids, chunks) => {
1516 } ;
1617} ;
1718
18- describe ( "WebWorkerMainTemplatePlugin" , function ( ) {
19+ describe ( "WebWorkerMainTemplatePlugin" , function ( ) {
1920 let env ;
2021
2122 beforeEach ( ( ) => {
2223 env = { } ;
2324 } ) ;
2425
25- it ( "has apply function" , function ( ) {
26+ it ( "has apply function" , function ( ) {
2627 ( new WebWorkerMainTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ;
2728 } ) ;
2829
29- describe ( "when applied" , function ( ) {
30- beforeEach ( function ( ) {
30+ describe ( "when applied" , function ( ) {
31+ beforeEach ( function ( ) {
3132 env . eventBindings = applyPluginWithOptions ( WebWorkerMainTemplatePlugin ) ;
3233 env . handlerContext = {
33- requireFn : ' requireFn' ,
34- indent : ( value ) => typeof value === ' string' ? value : value . join ( "\n" ) ,
34+ requireFn : " requireFn" ,
35+ indent : ( value ) => typeof value === " string" ? value : value . join ( "\n" ) ,
3536 asString : ( values ) => values . join ( "\n" ) ,
3637 renderCurrentHashCode : ( value ) => value ,
3738 outputOptions : {
38- chunkFilename : ' chunkFilename'
39+ chunkFilename : " chunkFilename"
3940 } ,
4041 applyPluginsWaterfall : ( moduleName , fileName , data ) => {
41- return `"${ moduleName } ${ data . hash } ${ data . hashWithLength ( ) } ${ data . chunk && data . chunk . id || '' } "` ;
42+ return `"${ moduleName } ${ data . hash } ${ data . hashWithLength ( ) } ${ data . chunk && data . chunk . id || "" } "` ;
4243 } ,
43- renderAddModule : ( ) => ' renderAddModuleSource();' ,
44+ renderAddModule : ( ) => " renderAddModuleSource();" ,
4445 } ;
4546 } ) ;
4647
47- it ( "binds five event handlers" , function ( ) {
48+ it ( "binds five event handlers" , function ( ) {
4849 env . eventBindings . length . should . be . exactly ( 5 ) ;
4950 } ) ;
5051
51- describe ( "local-vars handler" , function ( ) {
52+ describe ( "local-vars handler" , function ( ) {
5253 beforeEach ( ( ) => {
5354 env . eventBinding = env . eventBindings [ 0 ] ;
5455 } ) ;
@@ -64,18 +65,18 @@ describe("WebWorkerMainTemplatePlugin", function () {
6465 } ) ;
6566
6667 it ( "returns the original source" , ( ) => {
67- env . source . should . be . exactly ( "moduleSource()" )
68+ env . source . should . be . exactly ( "moduleSource()" ) ;
6869 } ) ;
6970 } ) ;
7071
7172 describe ( "when chunks are provided" , ( ) => {
7273 beforeEach ( ( ) => {
7374 const chunk = createMockChunk ( [ 1 , 2 , 3 ] , [
74- ' foo' ,
75- ' bar' ,
76- ' baz'
75+ " foo" ,
76+ " bar" ,
77+ " baz"
7778 ] ) ;
78- env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , ' abc123' ) ;
79+ env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , " abc123" ) ;
7980 } ) ;
8081
8182 it ( "returns the original source with installed mapping" , ( ) => {
@@ -89,7 +90,7 @@ var installedChunks = {
89902: 1,
90913: 1
9192};
92- ` . trim ( ) )
93+ ` . trim ( ) ) ;
9394 } ) ;
9495 } ) ;
9596 } ) ;
@@ -106,7 +107,7 @@ var installedChunks = {
106107 describe ( "when called" , ( ) => {
107108 beforeEach ( ( ) => {
108109 const chunk = createMockChunk ( ) ;
109- env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , ' abc123' ) ;
110+ env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , " abc123" ) ;
110111 } ) ;
111112
112113 it ( "creates import scripts call and promise resolve" , ( ) => {
@@ -118,7 +119,7 @@ importScripts("asset-path" + abc123 + "" + abc123 + "" + chunkId + "");
118119}
119120resolve();
120121});
121- ` . trim ( ) )
122+ ` . trim ( ) ) ;
122123 } ) ;
123124 } ) ;
124125 } ) ;
@@ -139,16 +140,16 @@ resolve();
139140 } ) ;
140141
141142 it ( "returns the original source" , ( ) => {
142- env . source . should . be . exactly ( "moduleSource()" )
143+ env . source . should . be . exactly ( "moduleSource()" ) ;
143144 } ) ;
144145 } ) ;
145146
146147 describe ( "when chunks are provided" , ( ) => {
147148 beforeEach ( ( ) => {
148149 const chunk = createMockChunk ( [ 1 , 2 , 3 ] , [
149- ' foo' ,
150- ' bar' ,
151- ' baz'
150+ " foo" ,
151+ " bar" ,
152+ " baz"
152153 ] ) ;
153154 env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk ) ;
154155 } ) ;
@@ -163,7 +164,7 @@ renderAddModuleSource();
163164while(chunkIds.length)
164165installedChunks[chunkIds.pop()] = 1;
165166};
166- ` . trim ( ) )
167+ ` . trim ( ) ) ;
167168 } ) ;
168169 } ) ;
169170 } ) ;
@@ -180,7 +181,7 @@ installedChunks[chunkIds.pop()] = 1;
180181 describe ( "when called" , ( ) => {
181182 beforeEach ( ( ) => {
182183 const chunk = createMockChunk ( ) ;
183- env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , ' abc123' ) ;
184+ env . source = env . eventBinding . handler . call ( env . handlerContext , "moduleSource()" , chunk , " abc123" ) ;
184185 } ) ;
185186
186187 it ( "returns the original source with hot update callback" , ( ) => {
@@ -238,7 +239,7 @@ function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-
238239function hotDisposeChunk(chunkId) { //eslint-disable-line no-unused-vars
239240 delete installedChunks[chunkId];
240241}
241- ` . trim ( ) )
242+ ` . trim ( ) ) ;
242243 } ) ;
243244 } ) ;
244245 } ) ;
0 commit comments