@@ -81,3 +81,58 @@ const fixtures = require('../common/fixtures.js');
81
81
assert . match ( stderr , / E R R _ M A N I F E S T _ D E P E N D E N C Y _ M I S S I N G / ) ;
82
82
assert . match ( stderr , / d o e s n o t l i s t o s a s a d e p e n d e n c y s p e c i f i e r f o r c o n d i t i o n s : r e q u i r e , n o d e , n o d e - a d d o n s / ) ;
83
83
}
84
+
85
+ {
86
+ const policyFilepath = fixtures . path ( 'policy-manifest' , 'onerror-exit.json' ) ;
87
+ const mainModuleBypass = fixtures . path ( 'policy-manifest' , 'module-constructor-bypass.js' ) ;
88
+ const result = spawnSync ( process . execPath , [
89
+ '--experimental-policy' ,
90
+ policyFilepath ,
91
+ mainModuleBypass ,
92
+ ] ) ;
93
+ assert . notStrictEqual ( result . status , 0 ) ;
94
+ const stderr = result . stderr . toString ( ) ;
95
+ assert . match ( stderr , / T y p e E r r o r / ) ;
96
+ }
97
+
98
+ {
99
+ const policyFilepath = fixtures . path ( 'policy-manifest' , 'manifest-impersonate.json' ) ;
100
+ const createRequireBypass = fixtures . path ( 'policy-manifest' , 'createRequire-bypass.js' ) ;
101
+ const result = spawnSync ( process . execPath , [
102
+ '--experimental-policy' ,
103
+ policyFilepath ,
104
+ createRequireBypass ,
105
+ ] ) ;
106
+
107
+ assert . notStrictEqual ( result . status , 0 ) ;
108
+ const stderr = result . stderr . toString ( ) ;
109
+ assert . match ( stderr , / T y p e E r r o r / ) ;
110
+ }
111
+
112
+ {
113
+ const policyFilepath = fixtures . path ( 'policy-manifest' , 'onerror-exit.json' ) ;
114
+ const mainModuleBypass = fixtures . path ( 'policy-manifest' , 'main-constructor-bypass.js' ) ;
115
+ const result = spawnSync ( process . execPath , [
116
+ '--experimental-policy' ,
117
+ policyFilepath ,
118
+ mainModuleBypass ,
119
+ ] ) ;
120
+
121
+ assert . notStrictEqual ( result . status , 0 ) ;
122
+ const stderr = result . stderr . toString ( ) ;
123
+ assert . match ( stderr , / T y p e E r r o r / ) ;
124
+ }
125
+
126
+ {
127
+ const policyFilepath = fixtures . path ( 'policy-manifest' , 'onerror-exit.json' ) ;
128
+ const mainModuleBypass = fixtures . path ( 'policy-manifest' , 'main-constructor-extensions-bypass.js' ) ;
129
+ const result = spawnSync ( process . execPath , [
130
+ '--experimental-policy' ,
131
+ policyFilepath ,
132
+ mainModuleBypass ,
133
+ ] ) ;
134
+
135
+ assert . notStrictEqual ( result . status , 0 ) ;
136
+ const stderr = result . stderr . toString ( ) ;
137
+ assert . match ( stderr , / T y p e E r r o r / ) ;
138
+ }
0 commit comments