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

Include tests in npmjs.org tarball #131

Closed
orlitzky opened this issue Jun 23, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@orlitzky
Copy link

commented Jun 23, 2015

Hello, I'm working on creating a distro package for colors.js and we'd like to run the test suite before we install anything. The tarball I get from github has the tests directory, but the one from npmjs.org doesn't. I think this is because of the 'files' entry in package.json? If so, might you include the tests?

@Marak

This comment has been minimized.

Copy link
Owner

commented Jun 23, 2015

@stevenvachon

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

Tests are not distributed to npm because package managers are used for dependencies. One does not modify their dependencies.

@orlitzky

This comment has been minimized.

Copy link
Author

commented Jun 24, 2015

Apologies, I'm not trying to modify anything. Here's a typical scenario.

  1. The user wants to install colors.js
  2. We download the tarball (right now, from npmjs.org) and run through the build process. For javascript packages, we pretty much do nothing.
  3. Once the package is built (i.e. immediately in this case), we run the test suite for the package. We're doing npm test wherever that works.
    • If the test suite passes, great, we proceed with the install.
    • But if the test suite fails, we bail out. Maybe there's something weird on the user's system that the package authors didn't plan for. It would be irresponsible for us to install e.g. an accounting package that fails its floating point math tests!

So, I just want to run the test suite and then proceed with the install without modifying anything. If it fails, we still don't modify anything -- we just quit and the users file bugs to let us know to investigate.

@stevenvachon

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

Why not parse the npm's package.json file for the repository.url key(s) and do a git clone then npm test?

There's also npm repo colors which gives the url. This would probably work even for modules whose package.json does not have the repository.url keys.

@orlitzky

This comment has been minimized.

Copy link
Author

commented Jun 24, 2015

We don't like to use git to fetch upstream sources because then the git program (and all of Perl...) become dependencies of those packages. Users shouldn't need git installed to install colors.js.

But besides, it's easier to just grab the release from github where the tests directory is included =)

The only reason I'm bugging you about it is because there are tons of packages and little manpower, and the easier it is to create a package the better. Most packages follow a formula:

  1. Get the source from https://registry.npmjs.org/${PN}/-/${P}.tgz
  2. Unpack it into a directory called package
  3. Run npm test
  4. Install all the javascript stuff

Having to deviate from that just makes it a little extra work (times the number of packages where we have to). The ones that don't deviate can be "packaged" in only a few lines of text.

@orlitzky

This comment has been minimized.

Copy link
Author

commented Jan 24, 2017

I gave up on trying to package javascript stuff =)

@orlitzky orlitzky closed this Jan 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.