File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ module.exports.handler = function handler(options) {
115115 require('codemod-cli').runTransform(
116116 __dirname,
117117 process.argv[2] /* transform name */,
118- process.argv.slice(2 ) /* paths or globs */
118+ process.argv.slice(3 ) /* paths or globs */
119119 )
120120 ` ,
121121 {
Original file line number Diff line number Diff line change @@ -188,6 +188,49 @@ QUnit.module('codemod-cli', function(hooks) {
188188 } ) ;
189189 } ) ;
190190
191+ QUnit . module ( 'generated bin script' , function ( hooks ) {
192+ setupProject ( hooks ) ;
193+
194+ let userProject ;
195+ hooks . beforeEach (
196+ wrap ( function * ( ) {
197+ // fix mode of bin script (lost during sharedProject.copy())
198+ fs . chmodSync ( codemodProject . path ( 'bin/cli.js' ) , 0o755 ) ;
199+
200+ // includes simple identifier reverser
201+ yield execa ( EXECUTABLE_PATH , [ 'generate' , 'codemod' , 'main' ] ) ;
202+
203+ userProject = yield createTempDir ( ) ;
204+ process . chdir ( userProject . path ( ) ) ;
205+ } )
206+ ) ;
207+
208+ hooks . afterEach ( function ( ) {
209+ return userProject . dispose ( ) ;
210+ } ) ;
211+
212+ QUnit . test (
213+ 'works with globs' ,
214+ wrap ( function * ( assert ) {
215+ userProject . write ( {
216+ foo : {
217+ 'something.js' : 'let blah = bar' ,
218+ 'other.js' : 'let blah = bar' ,
219+ } ,
220+ } ) ;
221+
222+ yield execa ( codemodProject . path ( 'bin/cli.js' ) , [ 'main' , 'foo/*thing.js' ] ) ;
223+
224+ assert . deepEqual ( userProject . read ( ) , {
225+ foo : {
226+ 'something.js' : 'let halb = rab' ,
227+ 'other.js' : 'let blah = bar' ,
228+ } ,
229+ } ) ;
230+ } )
231+ ) ;
232+ } ) ;
233+
191234 QUnit . module ( 'programmatic API' , function ( hooks ) {
192235 setupProject ( hooks ) ;
193236
You can’t perform that action at this time.
0 commit comments