дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
feat(coverage): Run with Coverage and report import for Ruby (SimpleCov) (#1535)
Ruby had no coverage runner. Run with Coverage now works for ruby, bundle, rake, rspec and rails test configurations through SimpleCov, read from its .resultset.json (lines and branches). A project that starts SimpleCov itself keeps its own setup; otherwise a small preload starts it and writes the report to the IDE's run directory, so nothing is written into the project. The preload is loaded through RUBYLIB and a bare -r in RUBYOPT, because RUBYOPT can't take the spaces in the macOS data directory, and it steps aside in the bundle exec launcher, which loads it before Bundler puts the project's gems on the load path. A CI .resultset.json can be imported through Import a Coverage Report. Co-authored-by: kjeldahl <[email protected]>
Цей коміт міститься в:
1 джерело
915fec598f
коміт
4959b430b1
11 files changed
+316
-7
No files matched your search
@@ -57,6 +57,9 @@ describe("coverageSupports", () => {
|
||||
expect(coverageSupports(cfg("pnpm", ["run", "dev"]))).toBe(false);
|
||||
expect(coverageSupports(cfg("/v/bin/python3", ["-m", "pytest"]))).toBe(true);
|
||||
expect(coverageSupports(cfg("uv", ["run", "pytest"]))).toBe(true);
|
||||
expect(coverageSupports(cfg("/v/bin/ruby", ["-Ilib", "test/a_test.rb"]))).toBe(true);
|
||||
expect(coverageSupports(cfg("bundle", ["exec", "rspec"], { isTest: true }))).toBe(true);
|
||||
expect(coverageSupports(cfg("bundle", ["exec", "rake", "db:migrate"]))).toBe(false);
|
||||
expect(coverageSupports(cfg("make", ["test"]))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ const runsJvmTests = (args: readonly string[]) =>
|
||||
/**
|
||||
* Whether a coverage runner is known for `config` (cheap; the backend decides for real):
|
||||
* cargo test / run / nextest, go test, Maven / Gradle tests, package.json test scripts,
|
||||
* Node.js programs and Python.
|
||||
* Node.js programs, Python and Ruby (scripts, rspec, test rake tasks).
|
||||
*/
|
||||
export function coverageSupports(config: Pick<RunConfig, "command" | "args" | "kind" | "isTest">): boolean {
|
||||
const program = programName(config.command);
|
||||
@@ -43,6 +43,13 @@ export function coverageSupports(config: Pick<RunConfig, "command" | "args" | "k
|
||||
case "tsx":
|
||||
case "ts-node":
|
||||
return true;
|
||||
case "ruby":
|
||||
case "rspec":
|
||||
return true;
|
||||
case "bundle":
|
||||
case "rake":
|
||||
case "rails":
|
||||
return config.isTest;
|
||||
}
|
||||
return (
|
||||
config.kind === "python" ||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Coverage reports collected elsewhere: "Import a report collected in CI from
|
||||
* disk" (lcov, JaCoCo XML, Go cover profile) and "Manage Coverage Reports"
|
||||
* disk" (lcov, JaCoCo XML, Go cover profile, SimpleCov) and "Manage Coverage Reports"
|
||||
* (choose the shown suite, delete suites and remembered imports).
|
||||
*/
|
||||
import { useMemo, useState } from "react";
|
||||
@@ -35,7 +35,7 @@ async function pickReport(): Promise<string | null> {
|
||||
filters: [
|
||||
{
|
||||
name: "Coverage reports (lcov, JaCoCo XML, Go cover profile)",
|
||||
extensions: ["info", "lcov", "xml", "out", "txt", "cov", "coverprofile"],
|
||||
extensions: ["info", "lcov", "xml", "out", "txt", "cov", "coverprofile", "json"],
|
||||
},
|
||||
{ name: "All files", extensions: ["*"] },
|
||||
],
|
||||
|
||||
Reference in new issue
Заблокувати користувача