ipfs-inactive/interface-js-ipfs-core

Running tests in isolation on CLI

wraithgar opened this issue · 5 comments

After the big refactor of this library, it is no longer easy to run individual test suites in isolation. It used to be that one could at least run, for example, something like npx mocha [flags] test/core/interface/block.js in js-ipfs-api.

There is no way to do this anymore. All of the tests now run from one test file in the repos that consume this library. I don't see that there's a readily documented way to isolate tests out, which makes development very slow as one has to run the entire test suite to work on one small feature and its subsequent tests.

I see that in examples, all of the isolation is done via code, meaning that one's best option currently would be to write a one-off, temporary test file that manually duplicates the testing you want to isolate. One would have to remember to also remove this file before committing. This doesn't seem very handy or straightforward.

Is there any plan or mechanism for running isolated tests either by command or feature set on the cli?

Made a PR in aegir that's an attempt at solving this

You're correct, running tests like this from the CLI is not possible anymore. You'll need to find the subsystem you want to isolate tests from in interface.js and add the only option as either an array or boolean, docs here.

I think your PR to AEgir is a good solution to restore this ability 👍

Just a thought but we could always move the each subsystem out of interface.spec.js and into their own files again - that would restore the feature. I only put them all in the same file because it's short and saves on boilerplate.

The Aegir PR solves this problem in an even more granular way than reverting the files would.

closing as ipfs/aegir#252 has now been merged