Skip to content

test

run move unit test with vitest you can run with report for full gas reports

usage:

test
test report

test command

shell
aptos@deepmove>test

> wasm_test_aptos@1.0.0 test
> vitest run


 RUN  v3.0.8 E:/projects/wasm_test_aptos

 tests/wasm_tests.test.ts 23 tests 159ms
 wasm_tests > test get function 66ms (gas 1)
 wasm_tests > test get_vec function 10ms (gas 1)
 wasm_tests > test get_str function 3ms (gas 1)
 wasm_tests > test set_int function 4ms (gas 1)
 wasm_tests > test get_struct function 3ms (gas 1)
 wasm_tests > test set_struct no urls function 4ms (gas 1)
 wasm_tests > test set_struct urls function 3ms (gas 1)
 wasm_tests > test set_struct_t function 4ms (gas 1)
 wasm_tests > test set_struct_t2 function 3ms (gas 1)
 wasm_tests > test set_foo2 function 4ms (gas 1)
 wasm_tests > test set_foo_str function 3ms (gas 1)
 wasm_tests > test set_foo function 3ms (gas 1)
 wasm_tests > test set_foo_vector function 3ms (gas 1)
 wasm_tests > test set_foo_vector2 function 4ms (gas 1)
 wasm_tests > test set_foo_vector3 function 3ms (gas 1)
 wasm_tests > test set_foo_vector5 function 4ms (gas 1)
 wasm_tests > test get_foo function 3ms (gas 1)
 wasm_tests > test set_foo3 function 4ms (gas 1)
 wasm_tests > test set_foo5 function 4ms (gas 1)
 wasm_tests > test set_foo6 function 4ms (gas 1)
 wasm_tests > test set_mut_string function 5ms (gas 4)
 wasm_tests > test set_foo7 function 5ms (gas 1)
 wasm_tests > test test_signer function 4ms (gas 1)

 Test Files  1 passed (1)
      Tests  23 passed (23)
   Start at  11:38:09
   Duration  2.47s (transform 146ms, setup 0ms, collect 1.94s, tests 159ms, environment 0ms, prepare 134ms)

test report command

test report
shell
aptos@deepmove>test report

> wasm_test_aptos@1.0.0 test
> vitest run


 RUN  v3.0.8 E:/projects/wasm_test_aptos

 tests/wasm_tests.test.ts 23 tests 161ms
 wasm_tests > test get function 67ms (gas 1)
 wasm_tests > test get_vec function 13ms (gas 1)
 wasm_tests > test get_str function 4ms (gas 1)
 wasm_tests > test set_int function 4ms (gas 1)
 wasm_tests > test get_struct function 3ms (gas 1)
 wasm_tests > test set_struct no urls function 4ms (gas 1)
 wasm_tests > test set_struct urls function 3ms (gas 1)
 wasm_tests > test set_struct_t function 5ms (gas 1)
 wasm_tests > test set_struct_t2 function 4ms (gas 1)
 wasm_tests > test set_foo2 function 4ms (gas 1)
 wasm_tests > test set_foo_str function 3ms (gas 1)
 wasm_tests > test set_foo function 3ms (gas 1)
 wasm_tests > test set_foo_vector function 3ms (gas 1)
 wasm_tests > test set_foo_vector2 function 4ms (gas 1)
 wasm_tests > test set_foo_vector3 function 3ms (gas 1)
 wasm_tests > test set_foo_vector5 function 4ms (gas 1)
 wasm_tests > test get_foo function 3ms (gas 1)
 wasm_tests > test set_foo3 function 3ms (gas 1)
 wasm_tests > test set_foo5 function 3ms (gas 1)
 wasm_tests > test set_foo6 function 4ms (gas 1)
 wasm_tests > test set_mut_string function 5ms (gas 4)
 wasm_tests > test set_foo7 function 4ms (gas 1)
 wasm_tests > test test_signer function 4ms (gas 1)

 Test Files  1 passed (1)
      Tests  23 passed (23)
   Start at  11:41:52
   Duration  2.48s (transform 159ms, setup 0ms, collect 1.91s, tests 161ms, environment 0ms, prepare 140ms)


Gas Reports

╔═════════════════╤═══════════╤═════╤════════╤═════╤═══════╗
 address module
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 0x0 wasm_test
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 function min avg median max calls
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_foo 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_str 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_struct 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_vec 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo2 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo3 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo5 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo6 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo7 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_str 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector2 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector3 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector5 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_int 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_mut_string 4 4 4 4 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct 1 1 1 1 2
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct_t 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct_t2 1 1 1 1 1
╟─────────────────┼───────────┼─────┼────────┼─────┼───────╢
 test_signer 1 1 1 1 1
╚═════════════════╧═══════════╧═════╧════════╧═════╧═══════╝

Released under the MIT License.