redhat-et / redhat-et/ripwire

TypeScript: --affected misses node:test arrow callbacks when test and source filenames differ

Open
#60 3 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
2.1k
Forks
125
Avg merge
5h 42m
Merged PRs (30d)
136

Description

A passing `node:test` test directly calls an imported function, but `--affected` reports zero tests.
Moving the assertion into a named function restores detection.

Environment:

- Ripwire 0.5.0, release binary, `built_from=bacfa3b7b`.
- macOS ARM64, AppleClang 15.0.0.15000309 release build.
- Node.js v26.8.1 for runtime checks.
- Each example uses a new temporary directory and `--no-cache`.

Reproduce:

```sh
mkdir -p src test
cat > src/bounded.ts <<'EOF'
export function bounded(text: string): string {
return text.replace(/x/g, "");
}
EOF
cat > test/behavior.test.ts <<'EOF'
import test from "node:test";
import assert from "node:assert/strict";
import { bounded } from "../src/bounded.ts";
test("bounded removes x", () => { assert.equal(bounded("x value"), " value"); });
EOF
node --experimental-strip-types --test test/behavior.test.ts
ripwire . --no-cache --affected=src/bounded.ts
```

Node reports one passed test and zero failures.
Ripwire exits zero and produces this element, with the explanatory XML comments removed:

```xml

```

`ripwire . --no-cache --uses=bounded` finds the call site:

```xml

```

Control:

Replace the last line of the test with:

```ts
function checkBounded() { assert.equal(bounded("x value"), " value"); }
test("bounded removes x", checkBounded);
```

Repeat `ripwire . --no-cache --affected=src/bounded.ts`.
The result now reports `tests="1"` and includes:

```xml

```

Expected behavior:

Include `test/behavior.test.ts` for the direct call inside the arrow callback.
If callback indexing remains unsupported, report this test as a possible dependency using its resolved import.

The callback limitation is disclosed in the legend. This report requests support for this common test shape.
It does not claim that the current output promises complete coverage.

Version 0.5.0 finds `test/bounded.test.ts` through filename matching. That fallback does not cover differently named tests.
An agent that uses only the returned list can omit a passing regression test that directly exercises the changed function.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with src/bounded.ts and test/behavior.test.ts using the provided node:test examples, then inspect the --affected implementation and its callback indexing path. Compare the arrow-callback result with the named-function control case. Done means the differently named test is reported for --affected, or is reported as a possible dependency using its resolved import.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, node.js, typescript
Domain
cli, devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.