Giter Club home page Giter Club logo

test-npm-dependants's Introduction

test-npm-dependants

Run the test suites of all modules depending on a given module.

Read the blog post.

express-alpha

Usage

Use the CLI:

$ test-npm-dependants

  test-npm-dependants NAME STABLEVERSION [NEXTVERSION]

  Options:

    --help, -h         Print help text
    --version, -v      Print program version
    --filter, -f       Filter dependant names by this regexp
    --concurrency, -c  Test concurrency [Default: 4]
    --timeout, -t      Time out processes after x seconds [Default: 300]
    --output, -o       Output mode [terminal, verbose] [Default: terminal]

$ test-npm-dependants express 4.17.1 5.0.0-alpha.7

    test express dependants

 stable: 4.17.1
   next: 5.0.0-alpha.7
   time: 3m

    ⠼ ⠼  loopback Running test suite
    ✓ ×  hubot Breaks
    ⠼ ⠼  @theia/core Installing dependencies
    ✓ ×  probot Breaks
    ✓ ✓  @frctl/fractal Passes
    ⠼ ⠼  node-red Installing dependencies
    ✓ ✓  ember-cli Passes
    ⠼ ⠼  firebase-tools Running test suite
    ⠼ ⠼  appium-base-driver Running test suite

Use as an Op:

$ npm install -g @cto.ai/ops && ops account:signup
$ ops run @juliangruber/test-npm-dependants

Installation

$ npm install -g test-npm-dependants

Security

Running untrusted code on your computer is dangerous. This is why you should use this project via Ops instead, which will sandbox everything inside a Docker container:

Why Sandbox

Caveats

Tests will be run as child processes, so don't have a TTY attached. Any tests relying on it, for example those reading process.stdout.columns, are likely not going to work.

If you want to debug why a test isn't passing, pass --verbose and test output will be printed out.

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

test-npm-dependants's People

Contributors

dependabot[bot] avatar juliangruber avatar kc-dot-io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

christianmurphy

test-npm-dependants's Issues

[Discussion] Future Ideas

Awesome work @juliangruber! I have been looking at this space recently, so thought I would brain dump a bit and see if you liked any of these thoughts. Sorry for the unstructured issue, but I didn't want to create too much noise if some of this would not move forward.

1. Sandboxing

So I see that you are using this Op platform for some form of sandboxing, but for folks looking to do this in other environments, it would be nice to abstract this away so that folks could provide their own sandbox. An example of this, a docker container would be a great simple sandbox (and allow for simple testing of my next point). If there was an abstraction layer about what an execution looks like, we could use the orchestration layer in this module but run the actual un-trusted code remotely.

2. Node versions

For node, there is CITGIM, which tests node versions against many popular packages. We talked a bit about the matrix testing we really want, which is a matrix of this module version X dependant module version X this module dependency version X node version. Obviously this is huge matrix, so I will talk about a point on this next, but having a few more knobs would be awesome to test a more detailed matrix.

3. The test matrix

As I mentioned above, the matrix can get huge. One of the things we encountered at Netflix was that the larger number of dependents and matrix variants, the larger the load and longer the tests take. To improve this we can do a few things:

  1. Have a list of modules to test
  2. Only pick a random selection
  3. Add a learning algo to test the most likely to fail
  4. Have a staged approach (depending on the change and the SDLC stage, choose a different approach)

4. CI environments

I see you have #2, so this is probably on your mind, but I think this is a very important consideration. If you take a simple OSS setup on GitHub Actions, you probably want to leverage their matrix strategy. So having some story for this type of testing in an environment like that would be awesome. Again, I think this needs to be a bit abstracted so that folks with different CI systems can also use it.

5. Multi-Registry Support/Fetching Source

Looks like the package fetch-package-source does not really have hooks for alternate source fetching. It seems like just making this an option you can inject would solve for folks needing to fetch from different sources.


I wanted to get the conversation started, and I think I missed some other points we brought up in the Package Maintenance Working Group, but hopefully this helps. Also, If you are open to it I an on board with working on some of these ideas here in this repo, so let me know if you are open to PRs.

document (recommend) usage with npx

Not sure if you are familiar with npx, which is bundled with npm, but it's really good for running CLIs and similar "one-off" / one-time tools as an alternative to installing them globally. It execute just as if you installed it globally, except that it cleans up all its dependencies after it has completed.

An example using the current steps in the README would look like this:

$ npx test-npm-dependants -v

Another advantage (depending on how you look at it is) is that with a global install, users will be responsible for upgrading their global install to use newer versions. npx will always use the latest available pulled from the registry.

idea: limit test recursion

If a package includes test-npm-dependant as a test, there is the possibility that test-npm-dependent could call a project that would call test-npm-dependent.
This could cause exponential test growth (possibly infinite if there are circular dependencies).
It would be nice to have an option to disable test-npm-dependant in projects being tested.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.