@@ -49,40 +49,15 @@ export default function textFixtures({
4949 : fixturePath
5050 )
5151 it ( path . basename ( fixturePath ) . replace ( / \. j s $ / , '' ) , function ( ) {
52- let source = input
53- const position = source . indexOf ( '// position' )
54- let selectionStart
55- let selectionEnd
56- if ( position >= 0 ) {
57- selectionStart = selectionEnd = position
58- source = source . replace ( / ^ \s * \/ \/ p o s i t i o n [ ^ \r \n ] * ( \r \n ? | \n ) / gm, '' )
59- } else {
60- selectionStart = source . indexOf ( '/* selectionStart */' )
61- if ( selectionStart >= 0 ) {
62- source = source . replace ( '/* selectionStart */' , '' )
63- selectionEnd = source . indexOf ( '/* selectionEnd */' )
64- if ( selectionEnd < 0 ) {
65- throw new Error (
66- '/* selectionEnd */ must be given if /* selectionStart */ is'
67- )
68- }
69- source = source . replace ( '/* selectionEnd */' , '' )
70- }
71- }
72- if ( selectionStart < 0 ) selectionStart = position
73- if ( selectionEnd < 0 ) selectionEnd = position
7452 const options = { ...transformOptions , ...fixture . options }
75- if ( selectionStart >= 0 && selectionEnd >= 0 ) {
76- Object . assign ( options , { selectionStart, selectionEnd } )
77- }
7853
7954 const stats : Record < string , number > = { }
8055 const report = [ ]
8156 const parser = fixture . parser || defaultParser
8257 const j = parser ? jscodeshift . withParser ( parser ) : jscodeshift
8358 const doTransform = ( ) : string | null | void | undefined =>
8459 transform (
85- { path : file , source } ,
60+ { path : file , source : input } ,
8661 {
8762 j,
8863 jscodeshift : j ,
0 commit comments