22// See LICENSE in the project root for license information.
33
44import path from 'node:path' ;
5+ import nodeJsPath from 'node:path' ;
56
6- import { FileSystem } from '@rushstack/node-core-library' ;
7+ import { FileSystem , Path } from '@rushstack/node-core-library' ;
78import { MockScopedLogger } from '@rushstack/heft/lib/pluginFramework/logging/MockScopedLogger' ;
89import { StringBufferTerminalProvider , Terminal } from '@rushstack/terminal' ;
910
@@ -13,8 +14,12 @@ const projectFolder: string = path.resolve(__dirname, '../..');
1314const fixturesFolder : string = path . resolve ( __dirname , '../../src/test/fixtures' ) ;
1415
1516// Fake output folder paths — never actually written to disk because FileSystem.writeFileAsync is mocked.
16- const CSS_OUTPUT_FOLDER : string = '/fake/output/css' ;
17- const DTS_OUTPUT_FOLDER : string = '/fake/output/dts' ;
17+ const FAKE_OUTPUT_BASE_FOLDER : string = '/fake/output' ;
18+ const NORMALIZED_PLATFORM_FAKE_OUTPUT_BASE_FOLDER : string = Path . convertToSlashes (
19+ nodeJsPath . resolve ( FAKE_OUTPUT_BASE_FOLDER )
20+ ) ;
21+ const CSS_OUTPUT_FOLDER : string = `${ FAKE_OUTPUT_BASE_FOLDER } /css` ;
22+ const DTS_OUTPUT_FOLDER : string = `${ FAKE_OUTPUT_BASE_FOLDER } /dts` ;
1823
1924type ICreateProcessorOptions = Partial <
2025 Pick <
@@ -102,7 +107,11 @@ describe(SassProcessor.name, () => {
102107
103108 writtenFiles = new Map ( ) ;
104109 jest . spyOn ( FileSystem , 'writeFileAsync' ) . mockImplementation ( async ( filePath , content ) => {
105- writtenFiles . set ( filePath as string , content as string ) ;
110+ filePath = Path . convertToSlashes ( filePath ) . replace (
111+ NORMALIZED_PLATFORM_FAKE_OUTPUT_BASE_FOLDER ,
112+ FAKE_OUTPUT_BASE_FOLDER
113+ ) ;
114+ writtenFiles . set ( filePath , String ( content ) ) ;
106115 } ) ;
107116 } ) ;
108117
0 commit comments