Running the Integration Tests

When I try to run the integration tests, I get an error jest: not found and a reference to visit the yarn docs.

Do I need to manually install “jest”? I’m not familiar with yarn, jest and cargo yet :smile:

Thanks!

@laura,

The integration tests should be run inside the client container where jest is already installed, as it is a dependency of the enigma-contract repo that is used to create that image, so I would like to ask you more details about the specifics on how you are trying to run the integration tests, as you really should be encountering this error.

See step 3 here for additional details.

Best,
Victor

Hey Victor,

After sourcing the .env file I ran the command:
docker-compose exec client ./start_test.bash

I also bash’d into the container and tried to run it:

enigma-contract  init.bash  launch_ganache.bash  login_workers.bash  simpleHTTP1.bash  simpleHTTP2.bash  start_test.bash
root@client:~# ./start_test.bash
Waiting for enigma_p2p_1...
Waiting for enigma_p2p_1 to register...
yarn run v1.15.2
$ jest -c=test/integrationTests/jest.config.js 01_init.spec.js
/bin/sh: 1: jest: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.````

I wonder if I should upgrade to the latest testnet release?

laura

I bash’d into the client docker container and did a yarn install. That seemed to fix the jest: not found issue, but now I’m getting this result:

discovery-docker-network lauraweindorf$ docker-compose exec client ./start_test.bash
Waiting for enigma_p2p_1...
Waiting for enigma_p2p_1 to register...
yarn run v1.15.2
$ jest -c=test/integrationTests/jest.config.js 01_init.spec.js
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
 FAIL  test/integrationTests/01_init.spec.js
  ● Test suite failed to run

    Cannot find module 'dotenv' from 'contractLoader.js'

    > 1 | import dotenv from 'dotenv';
        | ^
      2 | 
      3 | import EnigmaTokenContract from '../../../build/contracts/EnigmaToken';
      4 | import SampleContract from '../../../build/contracts/Sample';

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
      at Object.<anonymous> (test/integrationTests/contractLoader.js:1:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        21.701s
Ran all test suites matching /01_init.spec.js/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hi @laura,

both errors that you are reporting here are strange in that these are dependencies that should already be present in that client container, and they hint at something else being wrong or missing.

Yes, I would advise to switch to the developer testnet that was released today, which in a sense is a wrapper to the discovery-docker-network that you are using here, but where all the images are precompiled for you, and most (or hopefully all!) of the friction has been removed to offer a much more pleasant and smooth user experience.

Best,
Victor

Ah okay. I was able to run one of the tests individually, in the container, after doing a yarn install so that makes sense!

Cool, I’m excited to try out the latest release!

Thanks @victor :smiley: