@@ -9,7 +9,9 @@ common.requireNoPackageJSONAbove();
99
1010const assert = require ( 'assert' ) ;
1111const { spawnSync } = require ( 'child_process' ) ;
12+ const { cpSync, rmSync } = require ( 'fs' ) ;
1213const fixtures = require ( '../common/fixtures.js' ) ;
14+ const tmpdir = require ( '../common/tmpdir.js' ) ;
1315
1416{
1517 const policyFilepath = fixtures . path ( 'policy-manifest' , 'invalid.json' ) ;
@@ -25,6 +27,23 @@ const fixtures = require('../common/fixtures.js');
2527 assert . match ( stderr , / p a t t e r n n e e d s t o h a v e a s i n g l e t r a i l i n g " \* " / ) ;
2628}
2729
30+ {
31+ tmpdir . refresh ( ) ;
32+ const policyFilepath = tmpdir . resolve ( 'file with % in its name.json' ) ;
33+ cpSync ( fixtures . path ( 'policy-manifest' , 'invalid.json' ) , policyFilepath ) ;
34+ const result = spawnSync ( process . execPath , [
35+ '--experimental-policy' ,
36+ policyFilepath ,
37+ './fhqwhgads.js' ,
38+ ] ) ;
39+
40+ assert . notStrictEqual ( result . status , 0 ) ;
41+ const stderr = result . stderr . toString ( ) ;
42+ assert . match ( stderr , / E R R _ M A N I F E S T _ I N V A L I D _ S P E C I F I E R / ) ;
43+ assert . match ( stderr , / p a t t e r n n e e d s t o h a v e a s i n g l e t r a i l i n g " \* " / ) ;
44+ rmSync ( policyFilepath ) ;
45+ }
46+
2847{
2948 const policyFilepath = fixtures . path ( 'policy-manifest' , 'onerror-exit.json' ) ;
3049 const result = spawnSync ( process . execPath , [
0 commit comments