Skip to content

test: run the tests that need the JavaScript plugin in a test task of their own - #2008

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:test/javascript-plugin-tests
Nov 17, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:test/javascript-plugin-tests

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #2007

Problem

Tests that need IntelliJ's JavaScript plugin never ran:

  • CI's default legs run IntelliJ IDEA Community, which has no JavaScript plugin.
  • On IntelliJ IDEA Ultimate, the tests' sandbox disables the JavaScript and CSS plugins (prepareTestSandbox, since ci: test on IntelliJ 2025.3 and 2026.3 too, on Linux #1931), so that they don't take over the .js, .ts and .css files that other tests give to LSP4IJ.

So DAPExpressionCodeFragmentJavaScriptTest, added by #2001 for #1998, returned at its first line in every run and passed without testing anything.

Change

  • A test task of its own: testJavaScript, registered with intellijPlatformTesting.testIde, runs the tests named *JavaScriptPluginTest in a sandbox that keeps the JavaScript plugin. test leaves them out.
  • Where it runs: the IntelliJ Platform Gradle Plugin makes check run it. On IntelliJ IDEA Ultimate (-PplatformType=IU), which bundles the plugin, it runs, so CI's 2026.3 leg runs it with no workflow change. Elsewhere it is skipped ("the IDE bundles the JavaScript plugin").
  • The test: renamed to DAPExpressionCodeFragmentJavaScriptPluginTest. It now fails instead of returning when the plugin isn't loaded, so a sandbox without the plugin shows up as a failure.

To run it locally: ./gradlew testJavaScript -PplatformType=IU.

Validation

Run Result
testJavaScript, IntelliJ IDEA Ultimate 2024.2 1 test, 0 failures
testJavaScript, IntelliJ IDEA Ultimate 2026.3 (CI's IU leg) 1 test, 0 failures
testJavaScript, Ultimate 2024.2, with the production change of #2001 reverted fails with the ClassCastException of #1998
testJavaScript, Community (default) skipped
test --tests '*JavaScriptPluginTest', Community no tests found: test leaves it out

The configuration cache is stored and reused in all of these runs.

Related: #1998, #2001, #1931, #1763.

… their own

The tests' sandbox disables the JavaScript and CSS plugins (redhat-developer#1931), and CI's default legs run IntelliJ
IDEA Community, which has neither. So DAPExpressionCodeFragmentJavaScriptTest (redhat-developer#2001) returned at its
first line in every run and passed without testing anything.

testJavaScript, registered with intellijPlatformTesting.testIde, runs the tests named
*JavaScriptPluginTest in a sandbox of its own, which keeps the JavaScript plugin; test leaves them out.
The IntelliJ Platform Gradle Plugin makes check run it. On IntelliJ IDEA Ultimate (-PplatformType=IU),
which bundles the plugin, it runs, as on CI's 2026.3 leg; elsewhere it is skipped. The test is renamed
to DAPExpressionCodeFragmentJavaScriptPluginTest, and fails instead of returning when the plugin isn't
loaded.

Validated:
- testJavaScript on IntelliJ IDEA Ultimate 2024.2 and 2026.3: 1 test, 0 failures.
- With the production change of redhat-developer#2001 reverted, it fails with the ClassCastException of redhat-developer#1998.
- On Community (the default), testJavaScript is skipped, and test doesn't run the test.
- The configuration cache is stored and reused.

Fixes redhat-developer#2007
@lagergren lagergren added this to the 0.31.0 milestone Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Added a dedicated verification task for JavaScript plugin tests, available when running on the IntelliJ IDEA platform.
    • JavaScript-specific tests are excluded from the regular test task and now report a clear failure if the required JavaScript language support is unavailable.

The build adds an IU-only task for JavaScript-plugin tests and excludes those tests from the regular test task. The renamed test class now fails with a diagnostic if the JavaScript language is unavailable.

Changes: JavaScript Plugin Tests

Layer / File(s) Summary
Route JavaScript-plugin tests
build.gradle.kts
Adds the testJavaScript verification task for IU and selects *JavaScriptPluginTest.class tests. The regular test task excludes that pattern.
Require the JavaScript language
src/test/java/com/redhat/devtools/lsp4ij/dap/DAPExpressionCodeFragmentJavaScriptPluginTest.java
Renames the test class to match the task’s selection pattern. The test now asserts that the JavaScript language is available and reuses the retrieved language for the file-language check.

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

Change: Other · Severity of issue fixed: Low

Suggested reviewers: muescha

Merge Risk: Minimal · up to eafae

This change adds a dedicated test task so the JavaScript-plugin test runs on IntelliJ IDEA Ultimate and fails if the plugin is missing, instead of silently passing. No concrete merge-blocking defect was found. The task's attachment to check rests on the plugin's behavior and the author's report, so confirm it in CI on an Ultimate leg.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#2007] Requirements: (1) a dedicated test task that runs only the JavaScript-plugin tests and leaves them out of test; (2) a sandbox that keeps the JavaScript and CSS plugins enabled; (3) the task … Make the diff of build.gradle.kts (base to head) readable. Confirm that the testJavaScript task: (a) selects only *JavaScriptPluginTest classes; (b) excludes them from test; (c) does not add JavaScript or com.intellij.css to `di…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title states the main change: the JavaScript-plugin tests now run in their own test task. The PR adds a testJavaScript task that runs *JavaScriptPluginTest tests with the JavaScript plugin kept en…
Description check Passed The description matches the changeset. It explains why the JavaScript-plugin tests never ran, adds the testJavaScript task, renames DAPExpressionCodeFragmentJavaScriptPluginTest, makes the test fail w…
Out of Scope Changes check Passed The changed files named in the summary are build.gradle.kts and DAPExpressionCodeFragmentJavaScriptPluginTest.java. The Java change renames the test class, adds a plugin-presence assertion, and up…
Full details: Title check

Explanation

The title states the main change: the JavaScript-plugin tests now run in their own test task. The PR adds a testJavaScript task that runs *JavaScriptPluginTest tests with the JavaScript plugin kept enabled, and the regular test task excludes them. The title matches this change.

Full details: Description check

Explanation

The description matches the changeset. It explains why the JavaScript-plugin tests never ran, adds the testJavaScript task, renames DAPExpressionCodeFragmentJavaScriptPluginTest, makes the test fail when the plugin is missing, and lists local run commands and validation results.

Full details: Out of Scope Changes check

Explanation

The changed files named in the summary are build.gradle.kts and DAPExpressionCodeFragmentJavaScriptPluginTest.java. The Java change renames the test class, adds a plugin-presence assertion, and updates its Javadoc. These changes implement issue #2007's requirement that a missing plugin fails the test. The build.gradle.kts change adds the dedicated testJavaScript task. That task implements #2007's requirement for a separate task with the plugin enabled. No unrelated change appears in the summary. The build.gradle.kts diff could not be read, so its full content is not checked. This verdict relies on the summary's description of that file.

Full details: Linked Issues check

Explanation

[#2007] Requirements: (1) a dedicated test task that runs only the JavaScript-plugin tests and leaves them out of test; (2) a sandbox that keeps the JavaScript and CSS plugins enabled; (3) the task runs on a CI leg whose IDE bundles the plugin; (4) the test fails when the plugin is missing. Requirement (4) is met. The reviewed test file DAPExpressionCodeFragmentJavaScriptPluginTest.java uses assertNotNull on Language.findLanguageByID("JavaScript") with a message naming ./gradlew testJavaScript -PplatformType=IU, so a missing plugin fails the test. The test body also resolves references for 10 JavaScript expressions, as the issue asks. Requirements (1) to (3) live in build.gradle.kts. The raw summary and PR description describe a testJavaScript task selected by the *JavaScriptPluginTest naming convention, excluded from test, and run on -PplatformType=IU. The diff of build.gradle.kts could not be read because its changed blobs are missing from the checkout. So the sandbox setting that keeps JavaScript and CSS enabled cannot be confirmed from source. The author's validation table reports runs on 2024.2 and 2026.3 with one test and zero failures. Those runs do not show the sandbox setting directly.

Resolution

Make the diff of build.gradle.kts (base to head) readable. Confirm that the testJavaScript task: (a) selects only *JavaScriptPluginTest classes; (b) excludes them from test; (c) does not add JavaScript or com.intellij.css to disabledPlugins for that task; (d) is wired into check for IU builds only.

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: 60ebc244-6272-4973-8852-72c7f8b802ee
Commits

Reviewing files that changed from the base of the PR and between 4ab08d4 and eafae82.

Files selected for processing: 2

  • build.gradle.kts
  • src/test/java/com/redhat/devtools/lsp4ij/dap/DAPExpressionCodeFragmentJavaScriptPluginTest.java

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

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.12%. Comparing base (4ab08d4) to head (eafae82).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2008      +/-   ##
==========================================
+ Coverage   49.11%   49.12%   +0.01%     
==========================================
  Files         812      812              
  Lines       32987    32987              
  Branches     6739     5102    -1637     
==========================================
+ Hits        16200    16205       +5     
- Misses      14241    14242       +1     
+ Partials     2546     2540       -6     

☔ 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 lagergren modified the milestones: 0.31.0, 0.30.0 Nov 17, 2026
@lagergren

Copy link
Copy Markdown
Collaborator Author

@angelozerr @muescha Tests that need IntelliJ's JavaScript plugin can now run, in testJavaScript:

On this PR's 2026.3 leg, ./gradlew check -PplatformVersion=2026.3 -PplatformType=IU ran testJavaScript, and DAPExpressionCodeFragmentJavaScriptPluginTest > testResolvingAReferenceInAJavaScriptFragment passed. With #2001's production change reverted, the same test fails with the ClassCastException of #1998, so #2001's fix is now covered on CI.

The PR changes no shipped code, only the test setup and a test, and it covers a fix that is in 0.30.0, so it goes into 0.30.0 too.

@lagergren
lagergren merged commit 6348fff into redhat-developer:main Nov 17, 2026
9 checks passed
@lagergren
lagergren deleted the test/javascript-plugin-tests branch November 17, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests that need the JavaScript plugin never run: give them a test task with the plugin enabled

1 participant