@@ -10,7 +10,7 @@ const outputPath = join(__dirname, '../output/options');
1010
1111test . after ( ( ) => del ( outputPath ) ) ;
1212
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]' ) ;
1414
1515test ( 'removeKeyHash' , async ( t ) => {
1616 const config = {
@@ -49,6 +49,44 @@ test('removeKeyHash', async (t) => {
4949 t . snapshot ( manifest ) ;
5050} ) ;
5151
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+
5290test ( 'useEntryKeys' , async ( t ) => {
5391 const config = {
5492 context : __dirname ,
0 commit comments