Skip to content

keystonejs/keystone-5

Repository files navigation

keystone-5

CircleCI

This is a prototype architecture for Keystone 5.

Everything is WIP.

Demo

Check out the demo: keystone-next.herokuapp.com

It is updated automatically when commits are merged into master.

You can reset the database by hitting the /reset-db page.

Getting Started

Keystone 5 is set up as a monorepo, using Bolt

First make sure you've got Bolt installed:

yarn global add bolt

Also make sure you have a local MongoDB server running (instructions).

If you don't have it installed, on MacOS use Homebrew (run these once):

brew install mongodb
brew services start mongodb

Then install the dependencies and start the test project :

bolt
bolt start

(This will start the project located in projects/basic)

Contributing

All source code should be formatted with Prettier.

Code is not automatically formatted in commit hooks to avoid unexpected behaviour, so we recommended using an editor plugin to format your code as you work.

You can also run bolt format to prettier all the things.

The lint script will validate source code with both eslint and prettier.

Testing

Keystone uses Jest for unit tests and Cypress for end to end tests. All tests can be run locally and on CircleCI

Unit tests

To run the unit tests, run the script

bolt jest

Unit tests for each package can be found in packages/<package>/tests and following the naming pattern <module>.test.js.

To see test coverage of the files touched by the unit tests, run

bolt jest --coverage

To see test coverage of the entire mono-repo, including files which have zero test coverage, use the special script

bolt coverage

End to end tests

Keystone tests end to end functionality with the help of Cypress.

Each project (ie; projects/basic, projects/login, etc) have their own set of Cypress tests. To run an individual project's tests, cd into that directory and run:

bolt cypress:run

Cypress can be run in interactive mode with its built in GUI, which is useful when developing and debugging tests:

bolt cypress:open

End to end tests live in project/**/cypress/integration/*spec.js.

It is possible to run all cypress tests at once from the monorepo root with the command:

bolt cypress:run

NOTE: The output from this command will mix together the output from each project being tested in parallel. This is only recommended as sanity check before pushing code.

License

Copyright (c) 2018 Jed Watson. Licensed under the MIT License.