Page MenuHomePhabricator

[ecash-lib] Allow use of .only in mocha test files
Needs ReviewPublic

Authored by bytesofman on Tue, Mar 11, 22:58.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Summary

Real pain to keep deleting and re-adding this when working on the repo. Now that we are using eslint flat config, arc lint will catch any lingering .only use

Test Plan

Add .only to a test file in ecash-lib, run arc lint, get a lint error, remove it, all good, npm test with a test using .only and only that test runs

Event Timeline

emack requested changes to this revision.Wed, Mar 12, 04:04
emack added a subscriber: emack.

Add .only to a test file in ecash-lib, run arc lint, get a lint error, remove it, all good, npm test with a test using .only and only that test runs

I added .only to describe('SLP Integration Test') and it is not the only test that is run.

image.png (840×692 px, 96 KB)

This revision now requires changes to proceed.Wed, Mar 12, 04:04

Add .only to a test file in ecash-lib, run arc lint, get a lint error, remove it, all good, npm test with a test using .only and only that test runs

I added .only to describe('SLP Integration Test') and it is not the only test that is run.

image.png (840×692 px, 96 KB)

npm test runs the non-integration tests; to run the integration tests you need to build the node and pass the binary as an env var...e.g. like this if you've built it in the build/ dir at the top level of the monorepo

first build the node with chronik and plugins (ecash-lib I think does not need this, but chronik-client and ecash-agora tests do)

from top level of the monorepo:

cd build
cmake -GNinja .. -DBUILD_BITCOIN_CHRONIK=ON -DBUILD_BITCOIN_CHRONIK_PLUGINS=ON
ninja

then, from modules/ecash-lib,

BUILD_DIR="${PWD}/../../build" npm run integration-tests

if you have .only on an integration test, this will run only that integration-test.

in this case -- you put .only on an integration test, then ran npm test --- expected behavior here is that the non-integration tests will run since there is no .only on them and npm test runs only the non-integration tests.

anyway for this diff, we aren't looking to test mocha