{"_id":"@bowtieddevops/bowtieddevops-test-package-1","_rev":"3-2e0685b258513c6133a7d389beb73f89","name":"@bowtieddevops/bowtieddevops-test-package-1","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@bowtieddevops/bowtieddevops-test-package-1","version":"0.1.0","description":"Clarunit, enables writing unit tests in Clarity","main":"src/index.ts","bin":{"bowtieddevops-test-package-1":"src/cli.ts"},"type":"module","scripts":{"test":"vitest run -- --coverage"},"repository":{"type":"git","url":"git+ssh://git@github.com/stacks-network/stacks-test-tools.git"},"keywords":["stacks","blockchain","clarity","clarinet"],"author":{"name":"Clarity WG"},"contributors":[{"name":"Friedger Muffke"},{"name":"Marvin Janssen"},{"name":"Fernando Foy"},{"name":"Jesus Najera"},{"name":"Nikos Baxevanis"}],"license":"MIT","bugs":{"url":"https://github.com/stacks-network/stacks-test-tools/issues"},"homepage":"https://github.com/stacks-network/stacks-test-tools#readme","dependencies":{"@hirosystems/clarinet-sdk":"^2.4.1","@stacks/transactions":"^6.11.0","chokidar-cli":"^3.0.0","path":"^0.12.7","typescript":"^5.2.2","vite":"^5.2.6","vitest":"^1.4.0","vitest-environment-clarinet":"^2.0.0"},"devDependencies":{"fast-check":"^3.15.0"},"_id":"@bowtieddevops/bowtieddevops-test-package-1@0.1.0","gitHead":"ca4bc147714083b56a15f1871253dd50b2b9d82b","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-/f1RUXRNUebmlGUhkpgfgG7Fac9d3QCp/AWe4ZPRalwYb2ueaUPILlORbQTtlIA0ZnIGxgayb3zOTUPn/IOHZA==","shasum":"8903f92152387efb7442777d96b0770f89135f7a","tarball":"https://registry.npmjs.org/@bowtieddevops/bowtieddevops-test-package-1/-/bowtieddevops-test-package-1-0.1.0.tgz","fileCount":40,"unpackedSize":161924,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxkLcf9lXJK4HvE+aXj71D3YVP2kpi1EqNbp3Y5HQr3AiEAwiLNqx2POnUEhJONnjd+WQm50/bhagroXVaK58dwQb0="}]},"_npmUser":{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"},"directories":{},"maintainers":[{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bowtieddevops-test-package-1_0.1.0_1712234750466_0.8986481102006556"},"_hasShrinkwrap":false},"0.1.1":{"name":"@bowtieddevops/bowtieddevops-test-package-1","version":"0.1.1","description":"Clarunit, enables writing unit tests in Clarity","main":"src/index.ts","bin":{"bowtieddevops-test-package-1":"src/cli.ts"},"type":"module","scripts":{"test":"vitest run -- --coverage"},"repository":{"type":"git","url":"git+ssh://git@github.com/stacks-network/stacks-test-tools.git"},"keywords":["stacks","blockchain","clarity","clarinet"],"author":{"name":"Clarity WG"},"contributors":[{"name":"Friedger Muffke"},{"name":"Marvin Janssen"},{"name":"Fernando Foy"},{"name":"Jesus Najera"},{"name":"Nikos Baxevanis"}],"license":"MIT","bugs":{"url":"https://github.com/stacks-network/stacks-test-tools/issues"},"homepage":"https://github.com/stacks-network/stacks-test-tools#readme","dependencies":{"@hirosystems/clarinet-sdk":"^2.4.1","@stacks/transactions":"^6.11.0","chokidar-cli":"^3.0.0","path":"^0.12.7","typescript":"^5.2.2","vite":"^5.2.6","vitest":"^1.4.0","vitest-environment-clarinet":"^2.0.0"},"devDependencies":{"fast-check":"^3.15.0"},"_id":"@bowtieddevops/bowtieddevops-test-package-1@0.1.1","gitHead":"7d0ea9e99540564e488c4e7d56c5677af65f8b59","_nodeVersion":"20.12.0","_npmVersion":"10.5.0","dist":{"integrity":"sha512-4SG1cIk+zHSTyNpg2nm5qJtMgR8Pp0XCb+oavMMyJkJTFQsLSgGN+N2bUhJZslKBNimIiojOpIHq4yWD0zEPyw==","shasum":"c9d4bc9dd938744974b2c2ea45fdb045b469be19","tarball":"https://registry.npmjs.org/@bowtieddevops/bowtieddevops-test-package-1/-/bowtieddevops-test-package-1-0.1.1.tgz","fileCount":40,"unpackedSize":161940,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF0ROUH7KFxXS6VBIjIOF4yPmugllVEPd0L2ZXrloqR8AiEAtLQi97XStlnv1cBojdTd4IXDruJ0QSiN5PbNz4l3/V4="}]},"_npmUser":{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"},"directories":{},"maintainers":[{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bowtieddevops-test-package-1_0.1.1_1712234936446_0.09840165442583748"},"_hasShrinkwrap":false},"0.1.2":{"name":"@bowtieddevops/bowtieddevops-test-package-1","version":"0.1.2","description":"Clarunit, enables writing unit tests in Clarity","main":"src/index.ts","bin":{"bowtieddevops-test-package-1":"src/cli.ts"},"type":"module","scripts":{"test":"vitest run -- --coverage"},"repository":{"type":"git","url":"git+ssh://git@github.com/stacks-network/stacks-test-tools.git"},"keywords":["stacks","blockchain","clarity","clarinet"],"author":{"name":"Clarity WG"},"contributors":[{"name":"Friedger Muffke"},{"name":"Marvin Janssen"},{"name":"Fernando Foy"},{"name":"Jesus Najera"},{"name":"Nikos Baxevanis"}],"license":"MIT","bugs":{"url":"https://github.com/stacks-network/stacks-test-tools/issues"},"homepage":"https://github.com/stacks-network/stacks-test-tools#readme","dependencies":{"@hirosystems/clarinet-sdk":"^2.4.1","@stacks/transactions":"^6.11.0","chokidar-cli":"^3.0.0","path":"^0.12.7","typescript":"^5.2.2","vite":"^5.2.6","vitest":"^1.4.0","vitest-environment-clarinet":"^2.0.0"},"devDependencies":{"fast-check":"^3.15.0"},"_id":"@bowtieddevops/bowtieddevops-test-package-1@0.1.2","gitHead":"a1f22f638379ce6770649c72697fa528bd820266","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-GTr1iBg65SHn5drvMLc3N/H3jbmFSSl/mKgVFP1BYobn35qLkQ0xTrRvIq7xtbM1NTbeNNNcMAskcQ4zA2WgGQ==","shasum":"2e98083126811320a533ee254d16043fa806a7c3","tarball":"https://registry.npmjs.org/@bowtieddevops/bowtieddevops-test-package-1/-/bowtieddevops-test-package-1-0.1.2.tgz","fileCount":40,"unpackedSize":161940,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDO0K4U+SzRlfhEAbgDBCLQziFQN8NfjOcSV85/FFDWagIgDHNsS3Yr8+5jG3Z49DtdcsvSjpZa5VOlSm9mm6nd86o="}]},"_npmUser":{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"},"directories":{},"maintainers":[{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bowtieddevops-test-package-1_0.1.2_1712273779075_0.7047406941554251"},"_hasShrinkwrap":false},"0.1.4":{"name":"@bowtieddevops/bowtieddevops-test-package-1","version":"0.1.4","description":"Clarunit, enables writing unit tests in Clarity","main":"src/index.ts","bin":{"bowtieddevops-test-package-1":"src/cli.ts"},"type":"module","private":false,"scripts":{"test":"vitest run -- --coverage"},"repository":{"type":"git","url":"git+ssh://git@github.com/stacks-network/stacks-test-tools.git"},"keywords":["stacks","blockchain","clarity","clarinet"],"author":{"name":"Clarity WG"},"contributors":[{"name":"Friedger Muffke"},{"name":"Marvin Janssen"},{"name":"Fernando Foy"},{"name":"Jesus Najera"},{"name":"Nikos Baxevanis"}],"license":"MIT","bugs":{"url":"https://github.com/stacks-network/stacks-test-tools/issues"},"homepage":"https://github.com/stacks-network/stacks-test-tools#readme","dependencies":{"@hirosystems/clarinet-sdk":"^2.4.1","@stacks/transactions":"^6.11.0","chokidar-cli":"^3.0.0","path":"^0.12.7","typescript":"^5.2.2","vite":"^5.2.6","vitest":"^1.4.0","vitest-environment-clarinet":"^2.0.0"},"devDependencies":{"fast-check":"^3.15.0"},"_id":"@bowtieddevops/bowtieddevops-test-package-1@0.1.4","gitHead":"f7ef39b0fe0510c14b0c9bd6276580019ca39563","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-idARF2CGQByNpikgPaiSoxjIi9YzUSWAYBc3/GTZFltdgQGghLf0aR+8AkxAkpZ1Hhl0uoqxdtQiNg6iGRWnIA==","shasum":"b8affce15c27fdc5ec49f081e893acc2533496b0","tarball":"https://registry.npmjs.org/@bowtieddevops/bowtieddevops-test-package-1/-/bowtieddevops-test-package-1-0.1.4.tgz","fileCount":40,"unpackedSize":161960,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7ydCG7uIT9FGV4qTL638lLLPMQdp7kp3OjWTzzqyprAiEA0H55dr6MbNarI81i2876matuSmVnv6Ygd1EZqogicZs="}]},"_npmUser":{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"},"directories":{},"maintainers":[{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bowtieddevops-test-package-1_0.1.4_1712273906456_0.1352893714950969"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-04T12:45:50.343Z","0.1.0":"2024-04-04T12:45:50.718Z","modified":"2024-04-04T23:38:26.814Z","0.1.1":"2024-04-04T12:48:56.642Z","0.1.2":"2024-04-04T23:36:19.233Z","0.1.4":"2024-04-04T23:38:26.658Z"},"maintainers":[{"name":"bowtieddevops","email":"bowtieddevops@gmail.com"}],"description":"Clarunit, enables writing unit tests in Clarity","homepage":"https://github.com/stacks-network/stacks-test-tools#readme","keywords":["stacks","blockchain","clarity","clarinet"],"repository":{"type":"git","url":"git+ssh://git@github.com/stacks-network/stacks-test-tools.git"},"contributors":[{"name":"Friedger Muffke"},{"name":"Marvin Janssen"},{"name":"Fernando Foy"},{"name":"Jesus Najera"},{"name":"Nikos Baxevanis"}],"author":{"name":"Clarity WG"},"bugs":{"url":"https://github.com/stacks-network/stacks-test-tools/issues"},"license":"MIT","readme":"# clarunit\n\nThis package allows you to write unit tests for Clarity smart contracts in the \nClarity language itself, as opposed to TypeScript. `clarunit` will automatically\ndetect test files and test functions.\n\nAn example Clarinet-sdk project using `clarunit` can be found in the `example`\nfolder.\n\n## Setup\n\n1. Install package `@stacks/clarunit` using your favourite package manager. (Be sure to\n   pin the version!)\n2. Create a test file in your existing `tests` folder, you can use any name but\n   using `clarunit.test.ts` is recommended.\n3. Add the following to the newly created file:\n   ```ts\n   import { clarunit } from \"clarunit\";\n   clarunit(simnet);\n   ```\n4. Run your tests per usual using `npm test` or `yarn test`.\n\n`clarunit` takes configuration from Clarinet via `Clarinet.toml`. It\nautomatically detects all instantiated test contracts.\n\n## Unit testing\n\n### Adding tests\n\nTo write unit tests, follow these steps:\n\n1. Create a new Clarity contract in the `./tests` folder. It can have any name\n   but it should end in `_test.clar`. Files that do not follow this convention\n   are ignored. (For example: `my-contract_test.clar` will be included and\n   `my-contract.clar` will not.)\n2. Add the new Clarity contract to `Clarinet.toml`.\n3. Write unit tests as public functions, the function name must start with\n   `test-`.\n\n### Writing tests\n\nUnit test functions should be public without parameters. If they return an `ok`\nresponse of any kind, the test is considered to have passed whereas an `err`\nindicates a failure. The failure value is printed so it can be used to provide a\nhelpful message. The body of the unit test is written like one would usually\nwrite Clarity, using `try!` and `unwrap!` and so on as needed.\n\nExample:\n\n```clarity\n(define-public (test-my-feature)\n\t(begin\n\t\t(unwrap! (contract-call? .some-project-contract my-feature) (err \"Calling my-feature failed\"))\n\t\t(ok true)\n\t)\n)\n```\n\n### Prepare function\n\nSometimes you need to run some preparation logic that is common to all or\nmultiple unit tests. If the script detects a function called `prepare`, it will\nbe invoked before calling the unit test function itself. The `prepare` function\nshould return an `ok`, otherwise the test fails.\n\n```clarity\n(define-public (prepare)\n\t(begin\n\t\t(unwrap! (contract-call? .some-project-contract prepare-something) (err \"Preparation failed\"))\n\t\t(ok true)\n\t)\n)\n\n(define-public (test-something)\n\t;; prepare will be executed before running the test.\n)\n```\n\n### Annotations\n\nYou can add certain comment annotations before unit test functions to add\ninformation or modify behaviour. Annotations are optional.\n\n| Annotation            | Description                                                                                                                                  |\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| `@name`               | Give the unit test a name, this text shows up when running unit tests.                                                                       |\n| `@no-prepare`         | Do not call the `prepare` function before running this unit test.                                                                            |\n| `@prepare`            | Override the default `prepare` function with another. The function name should follow the tag.                                               |\n| `@caller`             | Override the default caller when running this unit test. Either specify an account name or standard principal prefixed by a single tick `'`. |\n| `@mine-blocks-before` | Mine a number of blocks before running the test. The number of blocks should follow the tag.                                                 |\n\nExamples:\n\n```clarity\n(define-public (prepare) (ok \"Default prepare function\"))\n\n(define-public (custom-prepare) (ok \"A custom prepare function\"))\n\n;; A test without any annotations\n(define-public (test-zero) (ok true))\n\n;; @name A normal test with a name, the prepare function will run before.\n(define-public (test-one) (ok true))\n\n;; @name This test will be executed without running the default prepare function.\n;; @no-prepare\n(define-public (test-two) (ok true))\n\n;; @name Override the default prepare function, it will run custom-prepare instead.\n;; @prepare custom-prepare\n(define-public (test-three) (ok true))\n\n;; @name This test will be called with tx-sender set to wallet_1 (from the settings toml file).\n;; @caller wallet_1\n(define-public (test-four) (ok true))\n\n;; @name This test will be called with tx-sender set to the specified principal.\n;; @caller 'ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG\n(define-public (test-five) (ok true))\n\n;; @name Five blocks are mined before this test is executed.\n;; @mine-blocks-before 5\n(define-public (test-six) (ok true))\n```\n\n// test","readmeFilename":"README.md"}