Skip to content

Commit 7631c8a

Browse files
committed
docs: add a section to describe puyaTsTransformer scope
1 parent 95878de commit 7631c8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ npm i @algorandfoundation/algorand-typescript-testing
4242

4343
Let's write a simple contract and test it using the `algorand-typescript-testing` framework.
4444

45+
#### Simulating AVM
46+
47+
`algorand-typescript-testing` includes a TypeScript transformer (`puyaTsTransformer`) that ensures contracts (with `.algo.ts` extension) and tests (with `.spec.ts` or `.test.ts` extensions) behave consistently between Node.js and AVM environments.
48+
49+
The transformer replicates AVM behavior, such as integer-only arithmetic where `3 / 2` produces `1`. For code requiring standard Node.js behaviour (e.g., `3 / 2` produces `1.5`), place it in separate `.ts` files and reference them from test files.
50+
4551
#### Configuring vitest
4652

4753
If you are using [vitest](https://vitest.dev/) with [@rollup/plugin-typescript](https://www.npmjs.com/package/@rollup/plugin-typescript) plugin, configure `puyaTsTransformer` as a `before` stage transformer of the `typescript` plugin in `vitest.config.mts` file.

0 commit comments

Comments
 (0)