@@ -244,6 +244,27 @@ const compile = async (
244
244
return result ;
245
245
} ;
246
246
247
+ /**
248
+ * NOTE: What is this hack even?
249
+ * for sass-spec it validates output of message which includes input file's path, which libsass-asm
250
+ * doesn't uses but internally wires to virtual mounted path. This leads into test failure -
251
+ * for those in test runner, strip out mounted path to allow spec runner validates test output.
252
+ */
253
+ const overrideStdErr = ( { mountedFullPath, raw } : { mountedFullPath : string ; raw : string } ) => {
254
+ if ( ! process . env . SASS_SPEC ) {
255
+ return ;
256
+ }
257
+
258
+ d ( `overrideStdErr: specified as test runner, strip out mounted path from console output` ) ;
259
+
260
+ const root = mountedFullPath . slice ( 0 , mountedFullPath . indexOf ( path . resolve ( raw ) ) ) ;
261
+ const original = process . stderr . write . bind ( process . stderr ) ;
262
+ process . stderr . write = function ( arg : string ) {
263
+ const replaced = arg . replace ( root , '' ) ;
264
+ return original ( replaced ) ;
265
+ } ;
266
+ } ;
267
+
247
268
const main = async ( argv : Array < string > = process . argv ) => {
248
269
const options = commandLineArgs ( optionDefinitions , { argv, camelCase : true } ) ;
249
270
const displayHelp = options . help || Object . keys ( options ) . length === 0 ;
@@ -279,6 +300,8 @@ const main = async (argv: Array<string> = process.argv) => {
279
300
} ;
280
301
} ) ;
281
302
303
+ overrideStdErr ( mountedInput ) ;
304
+
282
305
const sassOption = buildSassOption ( context , options , ! ! mountedOutput ? mountedOutput . mountedFullPath : undefined ) ;
283
306
284
307
const result = options . stdin
0 commit comments