Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"path argument is required" error when running this codemod #32

Open
tomwayson opened this issue Oct 25, 2018 · 5 comments
Open

"path argument is required" error when running this codemod #32

tomwayson opened this issue Oct 25, 2018 · 5 comments

Comments

@tomwayson
Copy link

I'm running this codemod as part of ember-cli-update and I get the following error:

➜  ember-arcgis-server-services git:(chore/ember-3-5) ember-cli-update --run-codemods
? These codemods apply to your project. Select which ones to run. ember-test-h
elpers-codemod
npx: installed 383 in 9.299s

path argument is required

Usage: jscodeshift <path>... [options]

path     Files or directory to transform

Then it shows below:

Error: Command failed: /Users/tom/.npm/_npx/70046/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/bin/jscodeshift.sh -t /Users/tom/.npm/_npx/70046/lib/node_modules/ember-test-helpers-codemod/transforms/integration/index.js --extensions js,ts
    at makeError (/Users/tom/.npm/_npx/70046/lib/node_modules/ember-test-helpers-codemod/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/Users/tom/.npm/_npx/70046/lib/node_modules/ember-test-helpers-codemod/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

I'm upgrading my addon from 2.18 to 3.5 in steps for each minor (2.18 -> 3.0 -> 3.1 -> ...) and the above message is from after upgrading to 3.3, but I have seen the same message at each step that I've run this codemod on.

@rinoldsimon
Copy link

getting the same issue when upgrading from 3.4.3 to 3.5

@simonihmig
Copy link
Collaborator

It seems this happens when running the codemod automatically against a non-existing directory. For example I was able to reproduce this with an addon, that had /tests/integration but not /tests/acceptance. Running the codemod with the integration transforms worked, but for acceptance it failed with the exception shown above.

It seems this is what's happening:

  1. ember-cli-update runs both codemods without checking for the existence of the directories (https://github.com/ember-cli/ember-cli-update-codemods-manifest/blob/v2/manifest.json#L19-L20)
  2. codemod-cli does not check if the provided paths actually exist (I guess paths returned from globby is an empty array here: https://github.com/rwjblue/codemod-cli/blob/dd57dbaa2dade9f68aaeeed0410b9a2ae0d6046b/src/bin-support.js#L20)
  3. 💥

My approach would be to add a check to codemod-cli, and exit gracefully with a warning message if paths is empty.

Any other thoughts? /cc @rwjblue @kellyselden

@rwjblue
Copy link
Member

rwjblue commented Nov 9, 2018

Ya, seems good to me.

@kellyselden
Copy link
Contributor

Does it make sense to infer all the options and instead run ember-test-helpers-codemod only?

@xtagon
Copy link

xtagon commented May 8, 2020

When I encountered this error, adding an empty tests/acceptance directory wasn't enough to fix it, but generating a new acceptance test did. Just sharing that in case anyone is in a similar situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants