question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing changes during cli development

See original GitHub issue

I’m submitting a feature request

  • Library Version: 0.23.0

Please tell us about your environment:

  • Operating System: Linux (Ubuntu)

  • Node Version: 6.5.0

  • NPM Version: 3.10.0
  • Browser: all

  • Language: all

Current behavior: When making changes to the cli, in order to test it, one must either

  1. Edit the node_modules/aurelia-cli folder in a test project, or
  2. edit the files in the global installation when making changes that affect e.g. the new command.

When trying to do an npm link on the dev directory, npm will complain about esprima not being installed:

Error: Cannot find module 'esprima'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at /home/shoff/aurelia/aurelia/cli/lib/build/amodro-trace/lib/parse.js:5:62
    at Array.map (native)
    at define (/home/shoff/aurelia/aurelia/cli/lib/build/amodro-trace/lib/parse.js:5:36)
    at Object.<anonymous> (/home/shoff/aurelia/aurelia/cli/lib/build/amodro-trace/lib/parse.js:10:1)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)

Expected/desired behavior:

  • What is the expected behavior? Using npm link, npm install ./cli or node bin/aurelia-cli.js, the cli should work as normal, but with the local changes. Installing esprima as a dependeny or devDependency solves this. For some reason, using npm i -g aurelia-cli does not produce the same error, even although esprima cannot be found anywhere in the global installation. Adding the dependency might in fact save from future trouble as it becomes clear where it comes from. amodro-trace, which requires this module, has esprima in its dependencies. Therefore, I assume this would also be a good place for it in the cli.

  • What is the motivation / use case for changing the behavior? Testing changes to the cli should be easy and not involve having to potentially even edit the global installation manually.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
s-hoffcommented, Feb 25, 2017

@JeroenVinke I would like to address adding some form of documentation to this to avoid future ‘how do I test the cli?’ kind of questions. Even although now all it takes is an npm link, I feel like a line on it in the README or CONTRIBUTING would be appropriate.

0reactions
ghidellocommented, May 8, 2017

Worked like a charm and sorry for answering so late.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test early and often using the mabl CLI
Software teams that embrace early testing efforts can focus more time on new feature development and thus accelerate delivery of business ...
Read more >
Test-drive the development of your command-line applications ...
Rubyists love testing, and test -driven- development is becoming THE way to write code. But, do we do this with our command -line...
Read more >
4 Techniques for Testing Python Command-Line (CLI) Apps
In this article, you'll learn 4 essential testing techniques for Python command-line applications: "lo-fi" print debugging, using a visual debugger, ...
Read more >
Command Line Interface (CLI) tests - Apache Stratos
The CLI tests are integration tests - they test the CLI as a standalone application. Originally an attempt was made to write tests...
Read more >
Build a Time-Tracking CLI Application Using a Test-Driven ...
We'll use a test-driven development (TDD) approach to build a time-tracking application. Our CLI will let us do the following:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found