@@ -13,11 +13,11 @@ import {
13
13
matchesFile ,
14
14
replacementIterations ,
15
15
stringToRegex ,
16
- posixifyPaths ,
17
16
envFilter ,
18
17
} from '../../src/convert/replacements' ;
19
18
import { matchingContentFile } from '../mock' ;
20
19
import * as replacementsForMock from '../../src/convert/replacements' ;
20
+ import { posixify } from '../../src/utils/path' ;
21
21
22
22
config . truncateThreshold = 0 ;
23
23
@@ -155,7 +155,7 @@ describe('marking replacements on a component', () => {
155
155
assert ( cmp . xml ) ;
156
156
const result = await getReplacements ( cmp , [
157
157
// 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' } ,
159
159
] ) ;
160
160
expect ( result ) . to . deep . equal ( {
161
161
[ cmp . xml ] : [
@@ -171,7 +171,7 @@ describe('marking replacements on a component', () => {
171
171
it ( 'marks string replacements from file' , async ( ) => {
172
172
assert ( cmp . xml ) ;
173
173
const result = await getReplacements ( cmp , [
174
- { filename : posixifyPaths ( cmp . xml ) , stringToReplace : 'foo' , replaceWithFile : 'bar' } ,
174
+ { filename : posixify ( cmp . xml ) , stringToReplace : 'foo' , replaceWithFile : 'bar' } ,
175
175
] ) ;
176
176
expect ( result ) . to . deep . equal ( {
177
177
[ cmp . xml ] : [
@@ -188,7 +188,7 @@ describe('marking replacements on a component', () => {
188
188
it ( 'marks regex replacements on a matching file' , async ( ) => {
189
189
assert ( cmp . xml ) ;
190
190
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' } ,
192
192
] ) ;
193
193
expect ( result ) . to . deep . equal ( {
194
194
[ cmp . xml ] : [
@@ -204,8 +204,8 @@ describe('marking replacements on a component', () => {
204
204
it ( 'marks 2 replacements on one file' , async ( ) => {
205
205
assert ( cmp . xml ) ;
206
206
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' } ,
209
209
] ) ;
210
210
expect ( result ) . to . deep . equal ( {
211
211
[ cmp . xml ] : [
@@ -253,8 +253,8 @@ describe('marking replacements on a component', () => {
253
253
assert ( cmp . content ) ;
254
254
assert ( cmp . xml ) ;
255
255
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' } ,
258
258
] ) ;
259
259
expect ( result ) . to . deep . equal ( {
260
260
[ cmp . xml ] : [
@@ -280,7 +280,7 @@ describe('marking replacements on a component', () => {
280
280
assert ( cmp . xml ) ;
281
281
try {
282
282
await getReplacements ( cmp , [
283
- { filename : posixifyPaths ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'BAD_ENV' } ,
283
+ { filename : posixify ( cmp . xml ) , regexToReplace : '.*foo.*' , replaceWithEnv : 'BAD_ENV' } ,
284
284
] ) ;
285
285
assert . fail ( 'should have thrown' ) ;
286
286
} catch ( e ) {
@@ -291,7 +291,7 @@ describe('marking replacements on a component', () => {
291
291
assert ( cmp . xml ) ;
292
292
const result = await getReplacements ( cmp , [
293
293
{
294
- filename : posixifyPaths ( cmp . xml ) ,
294
+ filename : posixify ( cmp . xml ) ,
295
295
regexToReplace : '.*foo.*' ,
296
296
replaceWithEnv : 'BAD_ENV' ,
297
297
allowUnsetEnvVariable : true ,
0 commit comments