Skip to content
cccskills
FreePublished on GitHub

bazel-test-migration

Move IntelliJ JPS test modules to Bazel and diagnose failures that occur only under Bazel. The guide helps trace missing dependencies, plugins, test data, and runfiles, then verify the generated target and migrated tests.

OriginalShow the original description

Migrate IntelliJ JPS module tests to Bazel; debug Bazel-only failures.

JetBrains/intellij-community20,664 stars(GitHub 20,664 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Migrating a JPS test module to Bazel
  • Diagnosing a test failure that occurs only in Bazel
  • Checking Bazel dependencies and test data wiring

Files included (1)

  • SKILL.md7.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/bazel-test-migration/SKILL.md -->

Bazel Test Migration

Use this skill when switching an IntelliJ JPS test module to Bazel, fixing a Bazel-only test failure, or reviewing migration wiring.

Core Workflow

  1. Identify the real test module and Bazel label.

    • From the Ultimate root, community packages usually need @community//....
    • From a standalone community checkout, use //....
    • Do not assume the unqualified label is equivalent in both repositories.
  2. Treat .iml as the source of truth.

    • Add module dependencies to the test module .iml first.
    • Prefer scope="TEST" for new test-only dependencies.
    • Use RUNTIME only when the dependency must be present as a runtime plugin/resource/classpath entry and TEST is not enough.
    • Do not hand-maintain generated BUILD.bazel sections except for intentionally custom jps_test sections protected by ### skip generation section.
  3. Regenerate after every .iml or BUILD.bazel metadata change.

community/tools/bun.cmd build/jps-module.mjs register path/to/module.iml --fix-iml-eof
./build/jpsModelToBazel.cmd
  1. Verify with the Bazel target the user will run.
./bazel.cmd test --cache_test_results=no @community//path/to/package:target_test

For a community-only module in a standalone community checkout, run the same package as //path/to/package:target_test.

BUILD.bazel Rules

  • Keep custom jps_test sections at the top when a module already needs custom test options.
  • Protect a custom test section with:
### skip generation section `test module.name`
  • Preserve required test attributes such as tags, timeout, env, jvm_flags, and data.
  • Add a module to community/build/bazel-migrated-test-modules.txt only after the target is fully migrated and verified. The community JPS aggregator then skips the module, and tests.cmd refuses it. The file documents its format.
  • Do not use copy_file to patch missing jars or descriptors into runfiles. Prefer normal .iml dependencies, target runtime/data dependencies, or the existing shared mechanism for that class of test.

Dependency Decisions

Use the smallest dependency that matches what failed:

  • Compile error: add a normal module dependency to .iml.
  • Test code compiles but class/resource is absent at runtime: add a TEST-scope dependency if generated Bazel runtime wiring is enough; otherwise use runtime/data wiring in the custom jps_test.
  • Plugin descriptor extension/action/inspection is missing: load the owning plugin or content module, not the implementation class by hand.
  • Product plugin wrapper is required: add the wrapper plugin/module dependency to the test module rather than depending only on its internal content module.
  • Testdata is missing: add the testdata as data or ensure the existing generator includes it; do not rely on source-tree paths under Bazel.

Before changing tests, verify whether the failure is really a test assertion issue or just missing runtime/plugin/testdata wiring.

Common Bazel-Only Failures

No tests found

Check that test classes are in the generated *_test_lib, the Bazel target points to that test library, and the class names match the runner convention. If the module truly has no tests, there may be nothing to migrate.

Missing extension, inspection, action, keymap action, or file type

Search for the extension/action/inspection id and identify the descriptor that registers it. Add the owning plugin/module dependency. Do not manually register production extensions in test setup unless the test is explicitly about a local fake extension.

Example: an action registered into EditorGutterVcsPopupMenu needs the VCS implementation descriptor that owns that group, not just VCS API classes.

Plugin action group is not registered

If plugin A registers an action into a group contributed by plugin/module B, plugin A must depend on B or move the action registration into a B-aware optional/content descriptor. Fix the descriptor dependency when production loading is also inconsistent; fix the test dependency only when the test product intentionally omits an otherwise valid product plugin.

JPS compile-server classpath failure

When integration tests invoke JPS compilation, failures like missing JPS jars or compile-server plugin classpaths usually mean Bazel runfiles cannot resolve a plugin/module path the same way JPS does.

  • Prefer the common Bazel target mapping/runfiles mechanism.
  • Ensure Bazel repo mapping from the parent process is propagated when nested Bazel/JPS logic needs to resolve labels.
  • Do not compare file contents to guess class roots.
  • Do not copy individual plugin jars into runfiles as one-off fixes.

Missing required Bazel properties

If code expects Bazel-only properties such as target mappings or runfiles metadata, pass them through the jps_test target using the established option (jvm_flags, env, or data) and add the backing file to runfiles.

Standalone community differs from Ultimate

Re-check labels, repo mappings, and generated runfiles. A target can pass as @community//... from Ultimate and fail as //... in standalone community if the test relies on parent-repo runfiles or missing repo mapping.

TeamCity-only slowdown or timeout

Look for the first expensive operation under Bazel: indexing, plugin loading, coroutine dispatch, first service initialization, or filesystem/runfiles traversal. Prefer moving one-time initialization to setup or making the test wait for the actual condition. Avoid raising timeouts as the first fix.

Test Changes

Keep test edits minimal.

  • Prefer dependency/plugin/testdata wiring over changing assertions.
  • Do not add filters or exclusions to hide failures during migration.
  • Use assumptions only for genuine environment-gated tests, and pass required environment variables through Bazel so developers can still run the tests without editing BUILD.bazel.
  • Avoid moving test classes between modules to satisfy Bazel discovery; fix dependencies or target roots instead.
  • Avoid broad helper abstractions unless the same migration problem repeats across modules and there is already an established local pattern.

Debugging Checklist

  1. Read the failing idea.log, test.log, and JUnit XML if present.
  2. Search for the missing id/class/resource in descriptors and .iml files.
  3. Inspect the test target's generated runtime_deps, deps, data, env, and jvm_flags.
  4. Compare JPS and Bazel classpaths only to identify missing ownership; fix ownership in .iml or plugin descriptors.
  5. Run the smallest failing class or method with --cache_test_results=no.
  6. Run the whole migrated target after the focused failure passes.
  7. Run git diff --check before finishing.

Migration Completion

A module is migrated only when:

  • the correct Bazel target runs with --cache_test_results=no;
  • required plugin/runtime/testdata dependencies are declared normally;
  • generated BUILD.bazel matches .iml;
  • no migration-only test exclusions were added;
  • aggregator lists are updated when required;
  • known unrelated broken tests are documented explicitly in the final report.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

actions

FreeSummary

Implement or update IntelliJ `AnAction` classes and their `plugin.xml` registrations. Keep labels and descriptions in message bundles, configure optional icons, and launch suspending work through the event coroutine scope so synchronous action handling does not freeze the IDE.

  • Adding a new IntelliJ action
  • Updating an action's registration or icon
  • Moving action labels into a message bundle
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

code-style

FreeSummary

Write or review Kotlin and Java code in line with IntelliJ project conventions. The guidance covers language choice, formatting, sealed types, threading annotations, and safe handling of control flow exceptions so changes fit the surrounding codebase.

  • Writing a new Kotlin file that follows IntelliJ conventions
  • Reviewing Java code and checking its style guidance
  • Checking formatting, sealed-type handling, or exception handling
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

commits

FreeSummary

Create, amend, or rename IntelliJ commits with messages that follow the project’s ticket and label formats. Keep each commit focused, explain the reason and decision in the body when needed, and pass the message safely through the shell or PowerShell.

  • Writing a message for a change linked to a YouTrack ticket
  • Preparing a commit message for tests, cleanup, or documentation
  • Amending or renaming an existing IntelliJ commit
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

Compare how Python type checkers interpret a code snippet or file. The script runs selected tools, including ty, pyrefly, basedpyright, mypy, and zuban, then produces a Markdown report with verdicts, timings, and each checker's diagnostic output.

  • Comparing type inference for a Python snippet
  • Checking whether a Python expression should be a type error
  • Reviewing differences among Python type checkers
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

Shape Compose Desktop UI code by keeping composables focused on rendering and placing application decisions in presenters or coordinators. Get guidance on state ownership, effects, reusable component APIs, lazy-list keys, animation, and performance for individual UI changes.

  • Separating screen rendering from application decisions
  • Choosing which UI state belongs in composition
  • Structuring effects and coroutine work
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

compose-ui-audit

FreeSummary

Audit Compose Desktop code for architecture and runtime issues, including state ownership, effects, coroutine use, lazy lists, animation, and recomposition. It produces prioritized findings with file and line references, while keeping visual design outside the audit scope.

  • Auditing state ownership and presenter boundaries in a Compose screen
  • Investigating effects, coroutines, or flow collection in desktop UI
  • Reviewing recomposition, lazy-list, or animation performance concerns
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

See all skills by JetBrains

Report a problem with this skill