Skip to content

Add exit-code assertion to excluded test-file fixture test #30

Description

@CodeDeficient

Finding

The test default mode skips unsafe_type_assertion in test files (tests/ai-slop-detector.behavior.test.ts:413-431) only asserts on stdout content but does not verify the process exit code. The sister test default mode still reports unsafe_type_assertion in non-test files already asserts result.status === 1.

Without an explicit exit-code assertion, the test can pass when the process fails without producing the checked stdout text (e.g., crash before emitting output).

Evidence

// Current — no exit-code assertion:
try {
    assert.ok(!result.stdout.includes('unsafe_type_assertion'),
      "should not report as any in test files. stdout: " + result.stdout);
} finally { ... }

// Sister test — already has exit-code assertion for status 1:
try {
    assert.equal(result.status, 1, ...);
    ...
}

Requirements

The excluded test-file test must assert result.status === 0 before the stdout check, including stderr in the failure message.

Constraints

  • Do not alter production exit-code behavior.
  • Do not weaken the existing stdout assertion.
  • Do not remove or change the sister test's exit-code assertion.
  • Do not combine with unrelated test changes.

Validation

The test must fail (RED) if the fixture file has an actual finding and the process would exit non-zero, and pass (GREEN) when the finding is correctly excluded and the process exits 0.

Rollback

A reverted test-only commit restores current coverage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testTest coverage improvements

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions