- npm
- Python 3.10+
- Chrome
All instructions are expected to be run from the top level cellxgene directory unless otherwise specified.
For all make
commands, common.mk
automatically checks whether required environment variables are set and, if they are not set, assigns them default values from environment.default.json
.
You can set these environment variables manually with the export
shell command, as in export JEST_ENV=debug
, or you can just pass the variables as part of the command. E.g., HEADFUL=true make e2e
or JEST_ENV=debug npm run e2e
Client and server tests run on Travis CI for every push, PR, and commit to main
on github. End to end tests run nightly on main
only.
Steps to run the all unit tests:
- Start in the project root directory
make dev-env
make unit-test
To run unit tests for the client
code only:
- Start in the project root directory
cd client
make unit-test
To run E2E tests, run cd client
and make smoke-test
-
JEST_ENV
: This enables the following E2E test options. You can find their corresponding configs injest-puppeteer.config.js
:dev
- opens window, runs tests with minimal slowdown, close on exit.debug
- opens window, runs tests with 100ms slowdown, dev tools open, chrome stays open on exit.prod
[default] - run headless with no slowdown, window will not open.
-
HEADFUL
: Default isfalse
. When set totrue
, it will launch the Chrome window for visual inspection. E.g.,HEADFUL=true npm run e2e
-
HEADLESS
: Default istrue
. When set tofalse
, it will launch the Chrome window for visual inspection. E.g.,HEADLESS=false npm run e2e
-
cellxgene should be installed as specified in client dev
-
Follow launch instructions for client dev with dataset
example-dataset/pbmc3k
-
Run
npm run e2e
from theclient
directory -
To debug a failing test, add
debugger
in any line of JS code as breakpoint, and launch the test again withndb
. E.g.,ndb make e2e
orndb npm run e2e
.-
Please make sure to install
ndb
vianpm install -g ndb
-
Check out Debugging Tips for more ideas!
-
JEST_ENV=prod make pydist install-dist dev-env smoke-test
To install from the source tree
- Build the client and put static files in place:
make build-for-server-dev
- Install from local files:
make install-dev
To install from a candidate python distribution
- Make the distribution:
make pydist
- Install it:
make install-dist
cellxgene launch [options] <datafile>
ormake start-server
If you install cellxgene using make install-dev
the server will be restarted every time you make changes on the server code. If changes affects the client, the browser must be reloaded.
We use flake8
to lint python and black
for auto-formatting.
To auto-format code run make fmt
. To run lint checks on the code run make lint
.
If you would like to run the server tests individually, follow the steps below
- Install development requirements
make dev-env
- Run
make unit-test
in theserver
directory ormake unit-test-server
in the root directory.
- Install in a virtualenv
- May need to rebuild/reinstall when you make client changes
- Install prereqs for client:
make dev-env
- Install cellxgene server as described in the server install instructions above.
To launch with hot reloading, you need to launch the server and the client separately. Node's hot reloading starts the client on its own node server and auto-refreshes when changes are made to source files.
- Launch server (the client relies on the REST API being available):
cellxgene launch --debug [other_options] <datafile>
ormake start-server
- Launch client: in
client/
directory runmake start-frontend
- Client will be served on
localhost:3000
To build only the client: make build-client
We use eslint
to lint the code and prettier
as our code formatter.
If you would like to run the client tests individually, follow the steps below in the client
directory
- For unit tests run
make unit-test
- For the smoke test run
make smoke-test
for the standard smoke test suite andmake smoke-test-annotations
for the annotations test suite.
If you would like to run the smoke tests against a hot-reloaded version of the client:
- Start the hot-reloading servers as described in the Client dev section. If you plan to run the standard test suite (without annotations), you'll have to start the backend server with annotations disabled (e.g.
CXG_OPTIONS='--debug --disable-annotations' make start-server
). - From the project root,
cd client
- Run either the standard E2E test suite with
npm run e2e
or the annotations test suite withnpm run e2e-annotations
-
You can also install/launch the server side code from npm scrips (requires python3.10 with virtualenv) with the
scripts/backend_dev
script. -
Check out e2e Tests for more details