Skip to content

build: give testJavaScript the classes of the test source set, and fail it when it finds no test - #2125

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/run-the-javascript-plugin-tests
Nov 23, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/run-the-javascript-plugin-tests

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

What

testJavaScript runs the JavaScript plugin tests again (*JavaScriptPluginTest, today DAPExpressionCodeFragmentJavaScriptPluginTest). It now fails the build when, on an IDE that bundles the JavaScript plugin, it finds no test class.

Cause

Since #2072 set instrumentCode = false, testJavaScript has found no test class: on CI's IU 2026.3 leg, it logs Task :testJavaScript NO-SOURCE, and the build passes. The last run of main where the test ran is that of fe9f583, just before #2072 (run 44925663365); from cc1776f, #2072 itself, every run logs NO-SOURCE.

Gradle 9 gives the classes and the classpath of the test source set to the test task only. Of those, the IntelliJ Platform Gradle Plugin 2.20.0 gives a testIde task only the classes of instrumentTestCode (TestIdeTask: testClassesDirs = instrumentedTestCode + testClassesDirs), which instrumentCode = false leaves empty. A local build can hide this: a leftover build/instrumented/instrumentTestCode from a build with instrumentation on makes the task run those old classes.

Change

Test

  • ./gradlew testJavaScript -PplatformType=IU -PplatformVersion=2026.3 --rerun-tasks --no-build-cache runs 1 test, which passes, 4 times out of 4. The configuration cache is stored and then reused.
  • On the default IC 2024.2, the task is skipped, as the onlyIf for the JavaScript plugin is false, and the build passes.
  • With the new lines removed, testJavaScript on IU 2026.3 fails: "Could not evaluate spec for 'testJavaScript finds a **/*JavaScriptPluginTest.class'". On IC 2024.2 it's still skipped.
  • ./gradlew check -PplatformType=IU -PplatformVersion=2026.3 --rerun-tasks --no-build-cache passes: test runs 1861 tests (7 skipped), and testJavaScript runs 1, with no failures. DAPExpressionCodeFragmentJavaScriptPluginTest still passes after a day of not running.

…il it when it finds no test

Since redhat-developer#2072 set instrumentCode = false, testJavaScript has found no test class. On the IU 2026.3 leg
of CI, it logs "Task :testJavaScript NO-SOURCE", and the build passes. The last run of main where
DAPExpressionCodeFragmentJavaScriptPluginTest ran is that of fe9f583, just before redhat-developer#2072.

Gradle 9 gives the classes and the classpath of the test source set to the test task only. Of those,
the IntelliJ Platform Gradle Plugin 2.20.0 gives a testIde task only the classes of
instrumentTestCode (TestIdeTask: testClassesDirs = instrumentedTestCode + testClassesDirs), and
instrumentCode = false leaves those empty.

testJavaScript now takes testClassesDirs from the test source set, and adds its runtime classpath,
without that of main, whose classes and dependencies come from the plugin in the sandbox, as for test.
The test resources, and with them the HangingTestWatchdog listener, are now on its classpath too.

Gradle skips a test task that finds no test class as NO-SOURCE, before failOnNoDiscoveredTests can
apply. A second onlyIf, evaluated before that and only on an IDE that bundles the JavaScript plugin,
now fails the build when testJavaScript finds no *JavaScriptPluginTest class.
@lagergren lagergren added this to the 0.30.2 milestone Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • JavaScript plugin tests now use the test source set and runtime classpath.
    • When the JavaScript plugin is available but no matching test classes are found, the test task now reports an error instead of being silently skipped.

The testJavaScript task now sets its test classes and runtime classpath. When the IDE bundles the JavaScript plugin, the task throws a GradleException if it finds no matching test classes.

Changes: JavaScript test task

Layer / File(s) Summary
Task configuration and validation
build.gradle.kts
The task sets its test classes and runtime classpath while retaining its JavaScript test filter and plugin eligibility check. If the task is eligible but finds no matching test classes, it throws a GradleException.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to bc739

This change gives the JavaScript test task the test classes and classpath it needs, and fails the build when an eligible run finds no test. It only touches build configuration, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: testJavaScript now receives the test source set's classes, and the task fails when it finds no test. The changeset matches both points in build.gradle.kts.
Description check Passed The description explains the problem (testJavaScript reports NO-SOURCE since #2072), the cause (Gradle and IntelliJ Platform plugin test class wiring), the change to build.gradle.kts, and the verifica…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem (testJavaScript reports NO-SOURCE since #2072), the cause (Gradle and IntelliJ Platform plugin test class wiring), the change to build.gradle.kts, and the verification steps. It relates directly to the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0edda16-b00c-425b-9e71-2ef69076aba7
Commits

Reviewing files that changed from the base of the PR and between cf01997 and bc73942.

Files selected for processing: 1

  • build.gradle.kts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.55%. Comparing base (01c7a2a) to head (bc73942).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2125      +/-   ##
==========================================
+ Coverage   50.52%   50.55%   +0.03%     
==========================================
  Files         816      816              
  Lines       33897    33910      +13     
  Branches     5289     5290       +1     
==========================================
+ Hits        17126    17144      +18     
- Misses      14114    14116       +2     
+ Partials     2657     2650       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 7456af5 into redhat-developer:main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant