{"id":118863,"date":"2026-06-07T02:48:43","date_gmt":"2026-06-06T23:48:43","guid":{"rendered":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/"},"modified":"2026-06-07T02:48:43","modified_gmt":"2026-06-06T23:48:43","slug":"packtest","status":"publish","type":"mod","link":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/","title":{"rendered":"PackTest"},"content":{"rendered":"<p># PackTest<br \/>\nPackTest allows you to write game tests in a data pack. Tests are `*.mcfunction` files in a `test` folder. They can be used to test custom data packs.<\/p>\n<p>## Example<br \/>\n**`data\/example\/test\/foo.mcfunction`**<br \/>\n&#8220;`mcfunction<br \/>\n#> Summons an armor stand and finds it<br \/>\n# @template example:small_platform<br \/>\n# @optional<\/p>\n<p>summon armor_stand ~1.5 ~1 ~1.5<br \/>\nexecute positioned ~1.5 ~1 ~1.5 run assert entity @e[type=armor_stand,dx=0]<\/p>\n<p>assert predicate example:test<\/p>\n<p>setblock ~1 ~1 ~1 grass_block<br \/>\nexecute if block ~1 ~1 ~1 stone run succeed<\/p>\n<p>fail &#8220;Oh no&#8221;<br \/>\n&#8220;`<\/p>\n<p>### Async tests<br \/>\nTest functions can be asynchronous, using the `await` keyword!<br \/>\n&#8220;`mcfunction<br \/>\nsetblock ~ ~ ~ stone<br \/>\nsummon item ~ ~6 ~<\/p>\n<p>await entity @e[type=item,distance=..2]<\/p>\n<p>await delay 1s<\/p>\n<p>data merge entity @e[type=item,distance=..2,limit=1] {Motion: [0.0, 0.01, 0.0]}<br \/>\n&#8220;`<\/p>\n<p>## Running tests<br \/>\nTests can be run in-game using the `test` command.<br \/>\n* `test runall`: runs all the tests<br \/>\n* `test runall <namespace>`: runs all tests from a specified namespace<br \/>\n* `test run <test>`: runs the test with a specified name<br \/>\n* `test runfailed`: runs all the previously failed tests<br \/>\n* `test runthis`: runs the closes test<br \/>\n* `test runthese`: runs all tests within 200 blocks<\/p>\n<p>### Auto test server<br \/>\nTests can also be run automatically, for instance in a CI environment. When `-Dpacktest.auto` is set, the game test server will start automatically with the loaded tests. The process will exit when all tests have finished with the exist code set to the number of failed tests. <\/p>\n<p>Setting `-Dpacktest.auto.annotations` will emit GitHub annotations for all test failures and resource load errors.<\/p>\n<p>The following example can be adapted into a GitHub action workflow.<br \/>\n&#8220;`yaml<br \/>\non: [push, pull_request]<\/p>\n<p>env:<br \/>\n  # Make sure to update these links!<br \/>\n  TEST_FABRIC_SERVER: https:\/\/meta.fabricmc.net\/v2\/versions\/loader\/1.20.4\/0.15.3\/0.11.2\/server\/jar<br \/>\n  TEST_FABRIC_API: https:\/\/cdn.modrinth.com\/data\/P7dR8mSH\/versions\/JMCwDuki\/fabric-api-0.92.0%2B1.20.4.jar<br \/>\n  TEST_PACKTEST: https:\/\/cdn.modrinth.com\/data\/XsKUhp45\/versions\/18smpIeE\/packtest-1.6-mc1.20.4.jar<\/p>\n<p>jobs:<br \/>\n  test:<br \/>\n    runs-on: ubuntu-latest<br \/>\n    steps:<br \/>\n      &#8211; uses: actions\/checkout@v4<br \/>\n      &#8211; uses: actions\/setup-java@v4<br \/>\n        with:<br \/>\n          distribution: &#8216;temurin&#8217;<br \/>\n          java-version: &#8217;17&#8217;<br \/>\n      &#8211; name: Download and prepare files<br \/>\n        run: |<br \/>\n          curl -o server.jar $TEST_FABRIC_SERVER<br \/>\n          mkdir mods<br \/>\n          curl -o mods\/fabric-api.jar $TEST_FABRIC_API<br \/>\n          curl -o mods\/packtest.jar $TEST_PACKTEST<br \/>\n          mkdir -p world\/datapacks<br \/>\n          cp -r datapack world\/datapacks\/datapack<br \/>\n      &#8211; name: Run tests<br \/>\n        run: |<br \/>\n          java -Xmx2G -Dpacktest.auto -Dpacktest.auto.annotations -jar server.jar nogui<br \/>\n&#8220;`<\/p>\n<p>## Commands<\/p>\n<p>### `fail`<br \/>\n* `fail <text component>`: fails the current test and returns from the function<\/p>\n<p>### `succeed`<br \/>\n* `succeed`: always succeeds the current test and returns from the function<\/p>\n<p>### `assert`<br \/>\n* `assert <condition>`: if condition is unsuccessful, fails the current test and returns from the function<br \/>\n* `assert not <condition>`: if condition is successful, fails the current test and returns from the function<\/p>\n<p>### `await`<br \/>\n* `await <condition>`: similar to assert, but keeps trying the condition every tick until the test times our or the condition succeeds<br \/>\n* `await not <condition>`: keeps trying the condition until it fails<br \/>\n* `await delay <time>`: waits for a specified time with unit<\/p>\n<p>### Conditions<br \/>\n* `block <pos> <block>`: checks if the block at the specified position matches the block predicate<br \/>\n* `data &#8230;`: checks NBT data using the same syntax as `execute if score`<br \/>\n* `entity <selector>`: checks if the selector matches any entity (can also find entities outside the structure bounds)<br \/>\n* `predicate <predicate>`: checks a predicate in a data pack<br \/>\n* `score &#8230;`: checks scores using the same syntax as `execute if score`<br \/>\n* `chat <pattern> [<receivers>]`: checks whether a chat message was sent in the past tick matching a regex pattern<\/p>\n<p>## Dummies<br \/>\nFake players can be spawned using the `\/dummy` command. Dummies won&#8217;t save or load their data from disk, they will also not load their skin.<\/p>\n<p>* `dummy <name> spawn`: spawns a new dummy<br \/>\n* `dummy <name> respawn`: respawns the dummy after it has been killed<br \/>\n* `dummy <name> leave`: makes the dummy leave the server<br \/>\n* `dummy <name> jump`: makes the dummy jump, if currently on ground<br \/>\n* `dummy <name> sneak [true|false]`: makes the dummy hold shift or un-shift (not the same as currently crouching)<br \/>\n* `dummy <name> sprint [true|false]`: makes the dummy sprint or un-sprint<br \/>\n* `dummy <name> drop [all]`: makes the dummy drop the current mainhand, either one item or the entire stack<br \/>\n* `dummy <name> swap`: makes the dummy swap its mainhand and offhand<br \/>\n* `dummy <name> selectslot`: makes the dummy select a different hotbar slot<br \/>\n* `dummy <name> use item`: makes the dummy use its hand item, either mainhand or offhand<br \/>\n* `dummy <name> use block <pos> [<direction>]`: makes the dummy use its hand item on a block position<br \/>\n* `dummy <name> use entity <entity>`: makes the dummy use its hand item on an entity<br \/>\n* `dummy <name> attack <entity>`: makes the dummy attack an entity with its mainhand<br \/>\n* `dummy <name> mine <pos>`: makes the dummy mine a block<\/p>\n<p>## Directives<br \/>\nTests can be customized by placing certain directives as special comments at the start of the test function.<\/p>\n<p>* `@template`: the resource location of a structure template to use for the test, defaults to an empty 1x1x1 structure<br \/>\n* `@timeout`: an integer specifying the timeout, defaults to `100`<br \/>\n* `@optional`: whether this test is allowed to fail, defaults to `false`, if there is no value after the directive it is considered as `true`<br \/>\n* `@dummy`: whether to spawn a dummy at the start of the test and set `@s` to this dummy, taking a position which defaults to `~0.5 ~ ~0.5`<br \/>\n* `@batch`: the batch name for this test, defaults to `packtestBatch`<br \/>\n* `@beforebatch`: a command to run before this batch, there can only be one per batch<br \/>\n* `@afterbatch`: a command to run after this batch, there can only be one per batch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fabric mod for testing data packs, with data packs!<\/p>\n","protected":false},"featured_media":118864,"template":"","meta":{"_minecraft_slug":"packtest","_minecraft_project_id":"XsKUhp45","_minecraft_author":"Misode","_minecraft_license":"MIT","_minecraft_downloads":13411,"_minecraft_follows":16,"_minecraft_client_side":"unsupported","_minecraft_server_side":"required","_minecraft_storage_type":"zip","_minecraft_archive_name":"packtest.zip","_minecraft_size_bytes":3991873,"_minecraft_version_count":40,"_minecraft_updated_at":"2026-05-16T00:16:49.198652Z","_minecraft_date_created":"2023-12-21T03:35:17.698990Z","_minecraft_date_modified":"2026-04-04T17:25:22.978423Z","_minecraft_project_url":"https:\/\/modrinth.com\/mod\/packtest","_minecraft_icon_attachment_id":118864,"_minecraft_imported_at":"2026-06-06T23:48:44+00:00","_minecraft_import_hash":"8a8674785ad30d8b2e068408d4e94f29","_minecraft_versions":"","_minecraft_links":"","_minecraft_gallery":"","_minecraft_api_metadata":""},"mod_category":[97,126,90,92],"mod_loader":[99],"minecraft_version":[94,101,141,102,62,37,40,41,814,73,71,74,38,751,78,770,771,79,783,80,81,82,741,138,83,821,167],"class_list":["post-118863","mod","type-mod","status-publish","has-post-thumbnail","hentry","mod_category-fabric","mod_category-management","mod_category-optimization","mod_category-utility","mod_loader-fabric","minecraft_version-1-20-4","minecraft_version-1-20-5","minecraft_version-1-20-5-pre1","minecraft_version-1-20-6","minecraft_version-1-21","minecraft_version-1-21-1","minecraft_version-1-21-10","minecraft_version-1-21-11","minecraft_version-1-21-11-rc2","minecraft_version-1-21-2","minecraft_version-1-21-2-pre1","minecraft_version-1-21-3","minecraft_version-1-21-4","minecraft_version-1-21-4-pre1","minecraft_version-1-21-5","minecraft_version-1-21-5-rc1","minecraft_version-1-21-5-rc2","minecraft_version-1-21-6","minecraft_version-1-21-6-pre4","minecraft_version-1-21-7","minecraft_version-1-21-8","minecraft_version-1-21-9","minecraft_version-24w09a","minecraft_version-24w12a","minecraft_version-26-1","minecraft_version-26-1-snapshot-6","minecraft_version-26-1-1"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PackTest - Minecraft<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PackTest - Minecraft\" \/>\n<meta property=\"og:description\" content=\"Fabric mod for testing data packs, with data packs!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/\" \/>\n<meta property=\"og:site_name\" content=\"Minecraft\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/\",\"name\":\"PackTest - Minecraft\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp\",\"datePublished\":\"2026-06-06T23:48:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/#primaryimage\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp\",\"contentUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp\",\"width\":96,\"height\":96},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/packtest\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mods\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PackTest\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\",\"name\":\"Minecraft\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PackTest - Minecraft","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/","og_locale":"en_US","og_type":"article","og_title":"PackTest - Minecraft","og_description":"Fabric mod for testing data packs, with data packs!","og_url":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/","og_site_name":"Minecraft","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/","url":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/","name":"PackTest - Minecraft","isPartOf":{"@id":"https:\/\/vpesports.com\/minecraft\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/#primaryimage"},"image":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/#primaryimage"},"thumbnailUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp","datePublished":"2026-06-06T23:48:43+00:00","breadcrumb":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vpesports.com\/minecraft\/mods\/packtest\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/#primaryimage","url":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp","contentUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/packtest-icon-d8b2cd430f94ab5605fcc51b5d53c44e75bcbc29_96.webp","width":96,"height":96},{"@type":"BreadcrumbList","@id":"https:\/\/vpesports.com\/minecraft\/mods\/packtest\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vpesports.com\/minecraft\/"},{"@type":"ListItem","position":2,"name":"Mods","item":"https:\/\/vpesports.com\/minecraft\/mods\/"},{"@type":"ListItem","position":3,"name":"PackTest"}]},{"@type":"WebSite","@id":"https:\/\/vpesports.com\/minecraft\/#website","url":"https:\/\/vpesports.com\/minecraft\/","name":"Minecraft","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vpesports.com\/minecraft\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod\/118863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod"}],"about":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/types\/mod"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media\/118864"}],"wp:attachment":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media?parent=118863"}],"wp:term":[{"taxonomy":"mod_category","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_category?post=118863"},{"taxonomy":"mod_loader","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_loader?post=118863"},{"taxonomy":"minecraft_version","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/minecraft_version?post=118863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}