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

Convert test infa to something more reliable and new #649

Closed
roman-vanesyan opened this issue Jun 25, 2017 · 10 comments
Closed

Convert test infa to something more reliable and new #649

roman-vanesyan opened this issue Jun 25, 2017 · 10 comments
Milestone

Comments

@roman-vanesyan
Copy link
Collaborator

commander.js has pretty old test infra based on sinon and should, we can convert it to something more popular. With convertion we may archive the following goals: keep it up to date to today's requirements, to make it easier to make contributions and convert it to es6 (that plan, I has in my mind), and, finally, to make it cross-platform. The current test infra can only be run on *nix systems, but no way to run test on env. that has no bash (or similar shells) and make, like windows.

@roman-vanesyan roman-vanesyan changed the title Convert test infa to something more relabel and new Convert test infa to something more reliable and new Jun 27, 2017
@CheshireSwift
Copy link

CheshireSwift commented Dec 18, 2017

Hi, I've started working on this. I'm looking to move to mocha as the test framework, just replacing the Makefile + run.

It should:

  • Make contributions easier: tests are descriptively named.
  • Make it cross platform: mocha itself is pure Node, and I'll be structuring it such that the test command doesn't use globs or other POSIX magic (to keep Windows happy).

In this first pass I'll be making minimal changes to the test logic, other than sandboxing program config (i.e. using new Command() for each test), so there's no ES6 rewrites in it yet, though I'll be using lambdas to define the tests.

Shout if there's any issues with any of this! 😃

mojavelinux added a commit to mojavelinux/commander.js that referenced this issue Jan 22, 2018
mojavelinux added a commit to mojavelinux/commander.js that referenced this issue Jan 22, 2018
@mojavelinux
Copy link
Contributor

Although I like mocha, I think ava would be the best fit for this project. It's extremely simple and lightweight, and it can continue the practice of running the test files in separate node processes.

To help move this discussion forward, I started PR #755 with just two of the test files migrated. This should hopefully provide enough context to help the group come to a decision about whether or not this is the right choice.

using new Command() for each test

I totally agree we should be using new Command() for the test instead of using the global instance. That will make testing multiple scenarios in the same file feasible.

so there's no ES6 rewrites in it yet, though I'll be using lambdas to define the tests.

Given that 4 is the minimum node version supported, there's no reason not to use lambdas at least.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Mar 7, 2019

Adding some notes for reference.

Mocha and AVA are mentioned in this issue, and @mojavelinux has prototyped some tests with AVA in #755. (Thanks! Nice demo without wasting effort if go with something else.)

Jest is mentioned in #661.

I use Jest for testing my own CLI project including commander, and have not used AVA or Mocha.

For interest, I checked weekly downloads from npmjs.com:

  • AVA: 149 k weekly downloads
  • Mocha: 2.5 M weekly downloads
  • Jest: 4.4 M weekly downloads (and growing the fastest)

https://stackshare.io/stackups/ava-vs-jest-vs-mocha

(Side note: tests can run on Windows already with a little work! #916)

@victor-shelepen
Copy link

I am for mocha because it is almost every where on projects where I work. Jest is from React world.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Apr 27, 2019

@mojavelinux converted a couple of the test files to ava in #755 to show what it looks like, which I thought was a useful way of seeing real code for a modest time investment.

If someone is interested in showing what it would look like using jest, you could do a draft Pull Request with the same two files and a jest setup.

(And I made the same invitation in #927 for mocha.)

@shadowspawn
Copy link
Collaborator

Current contenders are AVA (#755 ) and Jest (#1005).

@shadowspawn
Copy link
Collaborator

Started move to Jest in #1035.

@shadowspawn shadowspawn added this to the v4.0.0 milestone Sep 14, 2019
@shadowspawn
Copy link
Collaborator

Moved to Jest on the develop branch for the next release (#1035).

@shadowspawn
Copy link
Collaborator

v4.0.0-0 prerelease published: #1067

@shadowspawn
Copy link
Collaborator

v4.0.0 has been released.

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

No branches or pull requests

5 participants