o1-labs / o1js

TypeScript framework for zk-SNARKs and zkApps

Home Page:https://docs.minaprotocol.com/en/zkapps/how-to-write-a-zkapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running Jest with `o1js` template

Pfed-prog opened this issue · comments

Gm, I am trying to figure out how to run jest with o1js and I have failed tremendously so far.

For example, after i clone this repo and run yarn jest I get Test Suites: 18 failed, 18 total

I am not sure how run tests with o1js correctly,

I have tried to use https://github.com/MinaFoundation/soulbound-tokens/blob/main/jest.config.js config from Soulbound NFTs, but unfortunately it does not seem to work either
image

Hey @Pfed-prog are you using the zkapp CLI zk project template? If yes, here are some ideas:

  • If TS says it "cannot find module 'o1js'..." then the first thing to check is if you have installed: npm i
  • The template doesn't use yarn so maybe things will be smoother if you just use npm to run tests: npm test

For example, after i clone this repo

If you're talking about the o1js repo, there should be notes in the README-dev.md:

  • Run all Jest tests with npm test
  • Run a single test with ./jest ./path/to/file

(After npm i and npm run build)

Thank you very much this works.