Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Dredd throws exception when using --server without further arguments #1465

Open
kylef opened this issue Aug 14, 2019 · 1 comment
Open

Dredd throws exception when using --server without further arguments #1465

kylef opened this issue Aug 14, 2019 · 1 comment
Labels
bug Epic: configuration Command line options, dredd init, dredd.yml

Comments

@kylef
Copy link
Member

kylef commented Aug 14, 2019

Describe the bug

When I pass --server without further arguments to Dredd while having dredd.yml, Dredd throws a JavaScript error instead of user friendly message.

To Reproduce

Copy dredd.yml from below, install Dredd and then run dredd --server.

$ npx dredd --server
error: args.replace is not a function TypeError: args.replace is not a function
    at module.exports (/Users/kyle/Projects/apiaryio/helium/functions/transform/node_modules/spawn-args/index.js:19:14)
    at CLI.runServerAndThenDredd (/Users/kyle/Projects/apiaryio/helium/functions/transform/node_modules/dredd/lib/CLI.js:202:26)
    at CLI.run (/Users/kyle/Projects/apiaryio/helium/functions/transform/node_modules/dredd/lib/CLI.js:299:12)
    at Object.<anonymous> (/Users/kyle/Projects/apiaryio/helium/functions/transform/node_modules/dredd/bin/dredd:56:10)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)

Expected behavior

Not entirely sure what the behaviour should be, perhaps an error that --server requires an argument?

What is in your dredd.yml?

dry-run: null
hookfiles: dredd/*.js
language: nodejs
server: null
server-wait: 3
init: false
custom:
  apiaryApiKey: ''
names: false
only: []
reporter: null
output: []
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
path: []
config: ./dredd.yml
blueprint: 'apiary.apib'
endpoint: 'https://redacted.example.com'

What's your dredd --version output?

$ npx dredd --version
dredd v11.2.17 (Darwin 18.7.0; x64)
@kylef kylef added the bug label Aug 14, 2019
@honzajavorek
Copy link
Contributor

I'd blame the optimist library in this case as well, perhaps including subsequent handling of the CLI args. Since the library is long overdue and outdated, the best fix would be IMHO to revamp the CLI & configuration altogether - #845

@honzajavorek honzajavorek added the Epic: configuration Command line options, dredd init, dredd.yml label Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Epic: configuration Command line options, dredd init, dredd.yml
Projects
None yet
Development

No branches or pull requests

2 participants