@@ -13,11 +13,11 @@ import {
1313 matchesFile ,
1414 replacementIterations ,
1515 stringToRegex ,
16- posixifyPaths ,
1716 envFilter ,
1817} from '../../src/convert/replacements' ;
1918import { matchingContentFile } from '../mock' ;
2019import * as replacementsForMock from '../../src/convert/replacements' ;
20+ import { posixify } from '../../src/utils/path' ;
2121
2222config . truncateThreshold = 0 ;
2323
@@ -155,7 +155,7 @@ describe('marking replacements on a component', () => {
155155 assert ( cmp . xml ) ;
156156 const result = await getReplacements ( cmp , [
157157 // spec says filename path should be posix. The mocks are using join, so on windows they are wrong
158- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
158+ { filename : posixify ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
159159 ] ) ;
160160 expect ( result ) . to . deep . equal ( {
161161 [ cmp . xml ] : [
@@ -171,7 +171,7 @@ describe('marking replacements on a component', () => {
171171 it ( 'marks string replacements from file' , async ( ) => {
172172 assert ( cmp . xml ) ;
173173 const result = await getReplacements ( cmp , [
174- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'foo' , replaceWithFile : 'bar' } ,
174+ { filename : posixify ( cmp . xml ) , stringToReplace : 'foo' , replaceWithFile : 'bar' } ,
175175 ] ) ;
176176 expect ( result ) . to . deep . equal ( {
177177 [ cmp . xml ] : [
@@ -188,7 +188,7 @@ describe('marking replacements on a component', () => {
188188 it ( 'marks regex replacements on a matching file' , async ( ) => {
189189 assert ( cmp . xml ) ;
190190 const result = await getReplacements ( cmp , [
191- { filename : posixifyPaths ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
191+ { filename : posixify ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
192192 ] ) ;
193193 expect ( result ) . to . deep . equal ( {
194194 [ cmp . xml ] : [
@@ -204,8 +204,8 @@ describe('marking replacements on a component', () => {
204204 it ( 'marks 2 replacements on one file' , async ( ) => {
205205 assert ( cmp . xml ) ;
206206 const result = await getReplacements ( cmp , [
207- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
208- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'baz' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
207+ { filename : posixify ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
208+ { filename : posixify ( cmp . xml ) , stringToReplace : 'baz' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
209209 ] ) ;
210210 expect ( result ) . to . deep . equal ( {
211211 [ cmp . xml ] : [
@@ -253,8 +253,8 @@ describe('marking replacements on a component', () => {
253253 assert ( cmp . content ) ;
254254 assert ( cmp . xml ) ;
255255 const result = await getReplacements ( cmp , [
256- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
257- { filename : posixifyPaths ( cmp . content ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
256+ { filename : posixify ( cmp . xml ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
257+ { filename : posixify ( cmp . content ) , stringToReplace : 'foo' , replaceWithEnv : 'FOO_REPLACEMENT' } ,
258258 ] ) ;
259259 expect ( result ) . to . deep . equal ( {
260260 [ cmp . xml ] : [
@@ -280,7 +280,7 @@ describe('marking replacements on a component', () => {
280280 assert ( cmp . xml ) ;
281281 try {
282282 await getReplacements ( cmp , [
283- { filename : posixifyPaths ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'BAD_ENV' } ,
283+ { filename : posixify ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'BAD_ENV' } ,
284284 ] ) ;
285285 assert . fail ( 'should have thrown' ) ;
286286 } catch ( e ) {
@@ -291,7 +291,7 @@ describe('marking replacements on a component', () => {
291291 assert ( cmp . xml ) ;
292292 const result = await getReplacements ( cmp , [
293293 {
294- filename : posixifyPaths ( cmp . xml ) ,
294+ filename : posixify ( cmp . xml ) ,
295295 regexToReplace : '.*foo.*' ,
296296 replaceWithEnv : 'BAD_ENV' ,
297297 allowUnsetEnvVariable : true ,
0 commit comments