Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch testing from Jest to Vitest [DRAFT] #233

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

switch testing from Jest to Vitest [DRAFT] #233

wants to merge 4 commits into from

Conversation

mr-zwets
Copy link
Member

@mr-zwets mr-zwets commented Nov 5, 2024

  • switch packages/cashc to vitest
  • switch packages/utils to vitest
  • switch packages/cashscript to vitest
  • run test on mainnet, check parallel issues
  • review all changes, check yarn.lock files
  • review changes to jestExtensions
  • fix exported typings of toLog, toFailRequire and toFailRequireWith

Cashc

has to fix 1 test because of white-spacing

todo: verify package.json commands

 ✓ ast/AST.test.ts (64)
 ✓ ast/Location.test.ts (38)
 ✓ compiler/compiler.test.ts (195) 416ms
 ✓ debugging/debugging.test.ts (3)
 ✓ generation/generation.test.ts (19)

 Test Files  5 passed (5)
      Tests  319 passed (319)
   Duration  1.98s (transform 781ms, setup 0ms, collect 5.63s, tests 1.21s, environment 1ms, prepare 773ms)

Utils

needs command to build dist before running vitest because of import issue

todo: double check import issue & verify package.json commands

 ✓ types.test.ts  (7 tests) 10ms
 ✓ hash.test.ts  (5 tests) 16ms
 ✓ data.test.ts  (12 tests) 16ms
 ✓ source-map.test.ts  (4 tests) 9ms
 ✓ script.test.ts  (33 tests) 30ms
 ✓ bitauth-script.test.ts  (12 tests) 79ms

 Test Files  6 passed (6)
      Tests  73 passed (73)
   Duration  1.95s (transform 760ms, setup 0ms, collect 4.42s, tests 160ms, environment 2ms, prepare 1.06s)

CashScript

todo: review changes to JestExtensions which ChatGPT turned into a Vitest extension,
fix exported typings of toLog, toFailRequire and toFailRequireWith

 ✓ e2e/Announcement.test.ts  (5 tests) 714ms
   ✓ Announcement > send > should succeed when announcing correct announcement 532ms
 ✓ e2e/Mecenas.test.ts  (5 tests) 676ms
   ✓ Mecenas > send > should succeed when sending pledge to receiver 536ms

 ↓ e2e/old/Mecenas.test.ts  (1 test | 1 skipped)
 ✓ e2e/TransferWithTimeout.test.ts  (6 tests) 1773ms
   ✓ TransferWithTimeout > send > should succeed when transfer is called after timeout block 529ms
   ✓ TransferWithTimeout > send > should succeed when transfer is called before timeout block 521ms
   ✓ TransferWithTimeout > send > should succeed when timeout is called after timeout block 535ms

 ✓ e2e/TokenCategoryCheck.test.ts  (2 tests) 594ms
   ✓ TokenCategoryCheck > send > can send if the input at index 1 does not contain tokens 527ms

 ✓ e2e/HodlVault.test.ts  (3 tests) 671ms
   ✓ HodlVault > send > should succeed when price is high enough 541ms
 ✓ e2e/BigInt.test.ts  (4 tests) 614ms
   ✓ BigInt > proofOfBigInt > should succeed when providing a number within 32b < x < 64b 525ms
 ✓ e2e/P2PKH.test.ts  (9 tests) 3290ms
   ✓ P2PKH-no-tokens > send > should succeed when using correct function arguments 550ms
   ✓ P2PKH-no-tokens > send > should succeed when providing UTXOs 522ms
   ✓ P2PKH-no-tokens > send > can call to() multiple times 520ms
   ✓ P2PKH-no-tokens > send > can send to list of recipients 521ms
   ✓ P2PKH-no-tokens > send > can include OP_RETURN data as an output 523ms
   ✓ P2PKH-no-tokens > send > can include UTXOs from P2PKH addresses 522ms

 ↓ e2e/network/FullStack.test.ts  (1 test | 1 skipped)
 ✓ Contract.test.ts  (13 tests) 3525ms
   ✓ Contract > getBalance > should return balance for existing contract 1777ms
   ✓ Contract > getBalance > should return zero balance for new contract 1709ms

 ↓ e2e/old/misc.test.ts  (1 test | 1 skipped)

 ✓ debugging.test.ts  (35 tests) 3736ms
   ✓ Debugging tests > require statements > should fail with correct error message for the final require statement in an if statement 356ms
 ✓ libauth-template/LibauthTemplate.test.ts  (8 tests) 32ms
 ✓ e2e/P2PKH-tokens.test.ts  (13 tests | 3 skipped) 4341ms
   ✓ P2PKH-tokens > send (tokens) > can send fungible tokens 614ms
   ✓ P2PKH-tokens > send (tokens) > can send NFTs 538ms
   ✓ P2PKH-tokens > send (tokens) > can automatically select UTXOs for fungible tokens 518ms
   ✓ P2PKH-tokens > send (tokens) > adds automatic change output for fungible tokens 537ms
   ✓ P2PKH-tokens > send (tokens) > can create new token categories 1045ms
   ✓ P2PKH-tokens > send (tokens) > adds automatic change output for NFTs 536ms
   ✓ P2PKH-tokens > send (tokens) > can disable automatic change output for fungible tokens 540ms
 ✓ e2e/misc.test.ts  (2 tests) 12803ms
   ✓ Simple Covenant > send > should succeed 559ms
   ✓ Simple Covenant > send > should succeed with bip68 relative timelock 12239ms
 ✓ e2e/transaction-builder/TransactionBuilder.test.ts  (8 tests | 1 skipped) 33537ms
   ✓ Transaction Builder > should return the same transaction as the simple transaction builder > for a single-output (+ change) transaction from a single type of contract 1788ms
   ✓ Transaction Builder > should return the same transaction as the simple transaction builder > for a multi-output (+ change) transaction with P2SH and P2PKH inputs 3390ms
   ✓ Transaction Builder > should build a transaction that can spend from 2 different contracts and P2PKH + OP_RETURN 8941ms
   ✓ Transaction Builder > should fail when fee is higher than maxFee 1648ms
   ✓ Transaction Builder > should succeed when fee is lower than maxFee 5513ms
   ✓ Transaction Builder > should fail when locktime is higher than current block height 4960ms
   ✓ Transaction Builder > should succeed when locktime is lower than current block height 7291ms

 Test Files  14 passed | 3 skipped (17)
      Tests  116 passed | 3 skipped | 4 todo (123)
   Duration  35.22s (transform 1.75s, setup 0ms, collect 14.69s, tests 66.32s, environment 5ms, prepare 2.39s)

Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cashscript ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 8:13am

@mr-zwets mr-zwets linked an issue Nov 5, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider moving automated tests to a Jest-alternative
1 participant