1+ import path , { normalize } from 'node:path'
12import { run } from 'jscodeshift/src/Runner'
23import prompts from 'prompts'
34import { transform } from '../transform'
@@ -7,6 +8,11 @@ const defaultOptions = {
78 silent : true ,
89}
910
11+ const { platform } = process
12+ const locale = path [ platform === 'win32' ? 'win32' : 'posix' ]
13+
14+ const transformerPath = ( inputPath : string ) => locale . normalize ( inputPath )
15+
1016jest . mock ( 'jscodeshift/src/Runner' , ( ) => ( {
1117 run : jest . fn ( ) ,
1218} ) )
@@ -28,7 +34,7 @@ describe('interactive mode', () => {
2834 expect ( run ) . toHaveBeenCalledTimes ( 1 )
2935 expect ( run ) . toHaveBeenCalledWith (
3036 expect . stringContaining ( '/transforms/magic-redirect.js' ) ,
31- expect . arrayContaining ( [ expect . stringContaining ( '/transforms/__testfixtures__' ) ] ) ,
37+ expect . arrayContaining ( [ expect . stringContaining ( transformerPath ( '/transforms/__testfixtures__' ) ) ] ) ,
3238 {
3339 babel : false ,
3440 dry : true ,
@@ -51,7 +57,7 @@ describe('interactive mode', () => {
5157 expect ( run ) . toHaveBeenCalledTimes ( 1 )
5258 expect ( run ) . toHaveBeenCalledWith (
5359 expect . stringContaining ( '/transforms/magic-redirect.js' ) ,
54- expect . arrayContaining ( [ expect . stringContaining ( '/transforms/__testfixtures__' ) ] ) ,
60+ expect . arrayContaining ( [ expect . stringContaining ( transformerPath ( '/transforms/__testfixtures__' ) ) ] ) ,
5561 {
5662 babel : false ,
5763 dry : true ,
@@ -74,7 +80,7 @@ describe('interactive mode', () => {
7480 expect ( run ) . toHaveBeenCalledTimes ( 1 )
7581 expect ( run ) . toHaveBeenCalledWith (
7682 expect . stringContaining ( '/transforms/magic-redirect.js' ) ,
77- expect . arrayContaining ( [ expect . stringContaining ( '/ __testfixtures__') ] ) ,
83+ expect . arrayContaining ( [ expect . stringContaining ( transformerPath ( ' __testfixtures__') ) ] ) ,
7884 {
7985 babel : false ,
8086 dry : true ,
0 commit comments