tact icon indicating copy to clipboard operation
tact copied to clipboard

Add cram-like tests for Tact CLI

Open anton-trunov opened this issue 1 year ago • 6 comments

Would be nice to have cram-like tests. It would be nice to stay within the JS/TS/Node.js ecosystem. On the other hand, something like oclif testing looks like too much JS. It should be based on snapshots, i.e. tests should look a lot like shell interaction histories, resembling e.g. this report. Btw, the cram-like framework we are going to pick should definitely support updating those snapshots.

anton-trunov avatar May 01 '24 17:05 anton-trunov

Here's the cram fork we might use, which continues developing its snapshot-based testing approach: https://github.com/prysk/prysk

novusnota avatar May 01 '24 17:05 novusnota

Here's the cram fork we might use, which continues developing its snapshot-based testing approach: https://github.com/prysk/prysk

As mentioned in the original post, I'd very much prefer not to mix the Node.js and Python ecosystem within one project.

anton-trunov avatar May 01 '24 17:05 anton-trunov

What if we only use it in CI? Although I agree with your point.

novusnota avatar May 01 '24 17:05 novusnota

We might end up doing that, but only as the last resort, if there are no alternatives with our ecosystem

anton-trunov avatar May 01 '24 17:05 anton-trunov

Jest has support for snapshot testing, which is probably the most compatible solution to our current repo layout: https://jestjs.io/docs/snapshot-testing

Although we'll have to wrap CLI calls a bit (in child_process calls or something like that)

novusnota avatar May 01 '24 17:05 novusnota

Jest does have snapshot tests and we use it in Tact. But I also used cram-like tests a lot with OCaml (https://dune.readthedocs.io/en/stable/reference/cram.html) and it's so much better for CLI apps testing than what Jest or oclif is offering.

anton-trunov avatar May 01 '24 17:05 anton-trunov