1- var should = require ( "should" ) ;
1+ "use strict" ;
22
3- var path = require ( "path" ) ;
4- var webpack = require ( "../lib/webpack" ) ;
3+ const should = require ( "should" ) ;
54
6- var RecordIdsPlugin = require ( "../lib/RecordIdsPlugin" ) ;
5+ const path = require ( "path" ) ;
6+ const webpack = require ( "../lib/webpack" ) ;
7+
8+ const RecordIdsPlugin = require ( "../lib/RecordIdsPlugin" ) ;
79
810function makeRelative ( compiler , identifier ) {
9- var context = compiler . context ;
10- return identifier . split ( "|" ) . map ( function ( str ) {
11- return str . split ( "!" ) . map ( function ( str ) {
12- return path . relative ( context , str ) ;
13- } ) . join ( "!" ) ;
14- } ) . join ( "|" ) ;
11+ const context = compiler . context ;
12+ return identifier . split ( "|" ) . map ( ( str ) =>
13+ str . split ( "!" )
14+ . map ( ( str ) => path . relative ( context , str ) ) . join ( "!" ) ) . join ( "|" ) ;
1515}
1616
17- describe ( "RecordIdsPlugin" , function ( ) {
17+ describe ( "RecordIdsPlugin" , ( ) => {
1818
19- var compiler ;
19+ let compiler ;
2020
21- before ( function ( ) {
21+ before ( ( ) => {
2222 compiler = webpack ( {
2323 entry : "./nodetest/entry" ,
2424 context : path . join ( __dirname , "fixtures" ) ,
@@ -28,18 +28,16 @@ describe("RecordIdsPlugin", function() {
2828 }
2929 } ) ;
3030
31- compiler . plugin ( "compilation" , function ( compilation , callback ) {
32- compilation . plugin ( "should-record" , function ( ) {
33- return true ;
34- } ) ;
31+ compiler . plugin ( "compilation" , ( compilation , callback ) => {
32+ compilation . plugin ( "should-record" , ( ) => true ) ;
3533 } ) ;
3634 } ) ;
3735
38- it ( "should cache identifiers" , function ( done ) {
39- compiler . compile ( function ( err , compilation ) {
36+ it ( "should cache identifiers" , ( done ) => {
37+ compiler . compile ( ( err , compilation ) => {
4038 if ( err ) done ( err ) ;
41- var pass = true ;
42- for ( var i = 0 ; i < compilation . modules . length ; i ++ ) {
39+ let pass = true ;
40+ for ( let i = 0 ; i < compilation . modules . length ; i ++ ) {
4341 try {
4442 should . exist ( compilation . modules [ i ] . portableId ) ;
4543 compilation . modules [ i ] . portableId . should . equal ( makeRelative ( compiler , compilation . modules [ i ] . identifier ( ) ) ) ;
0 commit comments