find-and-run-tests

द्वारा cloudflare

workerd में परीक्षणों को खोजने, बनाने और चलाने का तरीका। इसमें wd-test, kj_test लक्ष्य नामकरण, bazel क्वेरी पैटर्न और सामान्य फ़्लैग शामिल हैं। साथ ही मूल प्रोजेक्ट भी शामिल है…

npx skills add https://github.com/cloudflare/workerd --skill find-and-run-tests

Finding and Running Tests

workerd Tests

Test types

TypeFile extensionBUILD macroTarget suffix
JS/TS integration.wd-testwd_test()None (target name = rule name)
C++ unit*-test.c++kj_test()None

Finding targets

# Find test targets in a directory
bazel query 'kind("test", //src/workerd/api/tests:*)' --output label

# Find test targets matching a name
bazel query 'kind(".*_test", //src/workerd/...)' --output label 2>/dev/null | grep -i '<name>'

# Find tests that depend on a source file
bazel query 'rdeps(//src/..., //src/workerd/io:trace-stream, 1)' --output label 2>/dev/null | grep -i test

Running

# Stream test output (preferred for debugging)
bazel test //src/workerd/api/tests:url-test --test_output=streamed

# Run with fresh results (no cache)
bazel test //target --test_output=streamed --nocache_test_results

# Run specific test case within a kj_test
bazel test //target --test_arg='-f' --test_arg='test case name'

Common flags

FlagPurpose
--test_output=streamedStream test output to terminal in real time
--nocache_test_resultsForce re-run, don't use cached results
--test_timeout=120Override default test timeout (seconds)

Parent Project Integration Tests

If workerd is used as a submodule in a parent project, that project may have its own integration test framework with different conventions. Load the parent-project-skills skill to discover those conventions.

General principles that apply to any integration test framework

Target naming with variant suffixes. Some test macros generate multiple targets from a single source file by appending variant suffixes (e.g., @, @all-autogates, @force-sharding). If bazel says "is a source file, nothing will be built" or "No test targets were found", you likely need a suffix. Use bazel query 'kind("test", //path:*)' to discover the actual runnable target names.

Cached results hide changes. Always use --nocache_test_results when re-running after modifying test files or source code. Without it, bazel returns stale cached results with stale logs.

Verify the feature actually ran. After a test passes, search the test output for feature-specific evidence (script names, process types, subrequests, RPC calls). A passing test with no evidence the feature ran is not a valid test — see the test-driven-investigation skill.

Debugging test failures

  1. Always use --nocache_test_results when re-running after changes.
  2. Check test logs at the path shown in bazel output: bazel-out/.../testlogs/.../test.log
  3. Search logs for feature-specific keywords to verify the feature actually ran.
  4. Subrequest mismatches (in frameworks that verify subrequests) typically show the actual vs expected request details — compare control headers carefully.

cloudflare की और Skills

workerd-api-review
cloudflare
कार्य प्रदर्शन अनुकूलन, API डिज़ाइन और अनुकूलता, सुरक्षा कमज़ोरियाँ, और workerd कोड समीक्षा के लिए मानक विनिर्देश अनुपालन। tcmalloc-जागरूक को शामिल करता है…
official
workerd-safety-review
cloudflare
मेमोरी सुरक्षा, थ्रेड सुरक्षा, समवर्तीता, और workerd कोड समीक्षा के लिए महत्वपूर्ण पहचान पैटर्न। V8/KJ सीमा खतरे, जीवनकाल प्रबंधन को शामिल करता है,…
official
module-registry
cloudflare
जब workerd में मॉड्यूल रजिस्ट्री के साथ काम कर रहे हों — मॉड्यूल रिज़ॉल्यूशन, संकलन, मूल्यांकन या पंजीकरण को पढ़ना, संशोधित करना, डीबग करना या समीक्षा करना — तब लोड करें।
official
reproduce
cloudflare
क्लाउडफ्लेयर/एजेंट्स गिटहब इश्यू को पुनः उत्पन्न करने के लिए एक न्यूनतम एजेंट्स/वर्कर प्रोजेक्ट तैयार करें और इसे एक अस्थायी क्लाउडफ्लेयर खाते में डिप्लॉय करें, फिर रिपोर्ट करें…
official
local-explorer
cloudflare
स्थानीय एक्सप्लोरर या स्थानीय API में उत्पादों/संसाधनों को कैसे जोड़ें। नए स्थानीय APIs या UI रूट्स को लागू करते समय उपयोग करें...
official
commit-categories
cloudflare
चेंजलॉग और "नया क्या है" सारांश के लिए कमिट वर्गीकरण नियम। चेंजलॉग या व्हाट्स-न्यू कमांड में कमिट को वर्गीकृत करने से पहले लोड किया जाना चाहिए। प्रदान करता है…
official
architecture
cloudflare
कोडबेस में पहली बार नेविगेट करते समय, नया क्लाइंट मेथड जोड़ते समय, नया कंटेनर हैंडलर/सर्विस जोड़ते समय, या यह समझने के लिए उपयोग करें कि अनुरोध कैसे प्रवाहित होता है…
official
changesets
cloudflare
चेंजसेट बनाते समय, रिलीज़ तैयार करते समय, या वर्ज़न अपडेट करते समय उपयोग करें। इसमें शामिल है कि किन पैकेजों का संदर्भ लेना है, उपयोगकर्ता-सामने वाले चेंजसेट विवरण कैसे लिखने हैं,…
official