Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(testing) - consolidate testing frameworks across the project #819

Merged
merged 8 commits into from
Nov 11, 2023
Merged
2 changes: 1 addition & 1 deletion .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: check_changes
run: |
CHANGED_FILES=${{ steps.get-changed-files.outputs.all }}
if echo "$CHANGED_FILES" | grep -q "circuit" && ! echo "$CHANGED_FILES" | grep -q ".github/workflows/circuit-build.yml"; then
if echo "$CHANGED_FILES" | grep -q "\.circom"; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this change about?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yea sorry for not mentioning in the description! Basically this change is so that the e2e test only run when the actual circom files change, not any files in the circuits folder as it was until this commit. I was planning to introduce this with another PR but got carried away by not wanting to wait on circuits compilation for this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Great catch.

echo "CHANGED=true" >> $GITHUB_ENV
echo "Circuits have changes."
else
Expand Down
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,43 +108,33 @@ own unit tests.

### Unit tests

Unit tests within the project are built using [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/). Mocha is a test framework that provides the environment to write and run JavaScript tests, while Chai is an assertion library that allows us to write assertions in a more expressive and readable way.


The following submodules contain unit tests: `core`, `crypto`, `circuits`,
`contracts`, and `domainobjs`.

Except for the `contracts` submodule, run unit tests as such (the following
samajammin marked this conversation as resolved.
Show resolved Hide resolved
example is for `crypto`):
You can run all unit tests from the root directory of the repo by running:

```bash
cd crypto
npm run test
```

For `contracts` and `integrationTests`, run the tests one by one. This prevents
incorrect nonce errors.

First, start a Hardhat instance in a separate terminal:
Or you can run unit tests within each submodule. for example to run the `crypto` tests:

```bash
cd contracts
npm run hardhat
```

In another terminal you can run:

```bash
cd contracts
cd crypto
npm run test
```

Or run tests individual as such:
You can also run individual tests within submodules, for example:

```bash
cd contracts
npm run test-accQueue
npx jest AccQueue
```

Where both test commands run `AccQueue.test.ts`
This test command will run `AccQueue.test.ts`

Alternatively you can run all unit tests as follows, but you should
stop your Hardhat instance first as this will start its own instance
Expand Down
29 changes: 0 additions & 29 deletions circuits/jest.config.js

This file was deleted.

Loading
Loading