@@ -10,7 +10,7 @@ const outputPath = join(__dirname, '../output/options');
10
10
11
11
test . after ( ( ) => del ( outputPath ) ) ;
12
12
13
- const clean = ( what ) => what . replace ( / ( [ a - f 0 - 9 ] { 20 , 32 } ) / gi, '[test-hash]' ) ;
13
+ const clean = ( what ) => what . replace ( / ( [ a - f 0 - 9 ] { 16 , 32 } ) / gi, '[test-hash]' ) ;
14
14
15
15
test ( 'removeKeyHash' , async ( t ) => {
16
16
const config = {
@@ -49,6 +49,44 @@ test('removeKeyHash', async (t) => {
49
49
t . snapshot ( manifest ) ;
50
50
} ) ;
51
51
52
+ test ( 'removeKeyHash, custom hash length' , async ( t ) => {
53
+ const config = {
54
+ context : __dirname ,
55
+ entry : '../fixtures/file.js' ,
56
+ output : {
57
+ hashDigestLength : 16 ,
58
+ filename : '[contenthash].removeKeyHash.js' ,
59
+ path : join ( outputPath , 'removeKeyHashCustomLength' )
60
+ } ,
61
+ plugins : [
62
+ new CopyPlugin ( {
63
+ patterns : [
64
+ { from : '../fixtures/*.css' , to : '[name].[contenthash].[ext]' } ,
65
+ { from : '../fixtures/*.txt' , to : '[contenthash].[name].[ext]' }
66
+ ]
67
+ } )
68
+ ]
69
+ } ;
70
+
71
+ let { manifest } = await compile ( config , t ) ;
72
+
73
+ manifest = Object . keys ( manifest ) . reduce ( ( prev , key ) => {
74
+ prev [ clean ( key ) ] = clean ( manifest [ key ] ) ;
75
+ return prev ;
76
+ } , { } ) ;
77
+
78
+ t . snapshot ( manifest ) ;
79
+
80
+ ( { manifest } = await compile ( config , t , { removeKeyHash : false } ) ) ;
81
+
82
+ manifest = Object . keys ( manifest ) . reduce ( ( prev , key ) => {
83
+ prev [ clean ( key ) ] = clean ( manifest [ key ] ) ;
84
+ return prev ;
85
+ } , { } ) ;
86
+
87
+ t . snapshot ( manifest ) ;
88
+ } ) ;
89
+
52
90
test ( 'useEntryKeys' , async ( t ) => {
53
91
const config = {
54
92
context : __dirname ,
0 commit comments