-
Notifications
You must be signed in to change notification settings - Fork 1
fix(mutation): measure per-file to correct Stryker misreporting #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9234f77
fix(mutation): measure per-file to correct Stryker misreporting
goanpeca 8e20c86
test(mutation): raise purge/upload/download above the 65% gate
goanpeca 12df56b
test(mutation): cover all src files + harden small commands
goanpeca 80c2b57
chore(mutation): cover all of src + ratchet break threshold to 70
goanpeca 2b63a62
fix: harden mutation runner review fixes
goanpeca ece6821
fix: address latest PR review comments
goanpeca 72d6266
fix: normalize mutation runner entrypoint
goanpeca ac3b1bb
fix: run PR gates for Dependabot
goanpeca b02c39b
test: tighten unhide marker assertion
goanpeca d81722f
chore: remove stale cspell word
goanpeca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,8 @@ streetsidesoftware | |
| prerelease | ||
| workflow_dispatch | ||
| checkout | ||
| startgroup | ||
| endgroup | ||
| ncconfig | ||
| nvmrc | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import { rm, writeFile } from 'node:fs/promises' | ||
| import { join } from 'node:path' | ||
| import { afterEach, beforeEach, describe, expect, it } from 'vitest' | ||
| import { headCommand } from '../../src/commands/head.ts' | ||
| import { hideCommand } from '../../src/commands/hide.ts' | ||
| import { unhideCommand } from '../../src/commands/unhide.ts' | ||
| import { tryStat } from '../../src/fs.ts' | ||
| import { captureStdout, makeFixture, makeInputs, seedFile, type TestFixture } from '../_helpers.ts' | ||
|
|
||
| // These tests pin the user-visible log surface (group labels + info lines) and | ||
| // the missing-source error wording for the small command wrappers, plus the | ||
| // tryStat error-swallowing contract. They exist to keep mutation coverage on | ||
| // code that is otherwise only exercised for its return value. | ||
| describe('head/hide/unhide log + error surface', () => { | ||
| let fx: TestFixture | ||
|
|
||
| beforeEach(async () => { | ||
| fx = await makeFixture('gh-action-logs') | ||
| }) | ||
|
|
||
| afterEach(async () => { | ||
| await rm(fx.workDir, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| it('head: groups the probe and logs size/type/sha1', async () => { | ||
| await seedFile(fx, 'h.txt', 'head-me') | ||
| let result: Awaited<ReturnType<typeof headCommand>> | undefined | ||
| const out = await captureStdout(async () => { | ||
| result = await headCommand(fx.bucket, makeInputs('head', fx, { source: 'h.txt' })) | ||
| }) | ||
| expect(result?.contentSha1).toBeTruthy() | ||
| expect(out).toContain('::group::head b2://gh-action-logs/h.txt') | ||
| expect(out).toContain( | ||
| `size=${result?.size} type=${result?.contentType} sha1=${result?.contentSha1}`, | ||
| ) | ||
| expect(out).toContain('::endgroup::') | ||
| }) | ||
|
|
||
| it('head: requires a source and names the action in the error', async () => { | ||
| await expect(headCommand(fx.bucket, makeInputs('head', fx))).rejects.toThrow( | ||
| "'source' input is required for 'head' action (the B2 file name)", | ||
| ) | ||
| }) | ||
|
|
||
| it('hide: groups the call and logs the created marker', async () => { | ||
| await seedFile(fx, 'g.txt', 'hide-me') | ||
| let result: Awaited<ReturnType<typeof hideCommand>> | undefined | ||
| const out = await captureStdout(async () => { | ||
| result = await hideCommand(fx.bucket, makeInputs('hide', fx, { source: 'g.txt' })) | ||
| }) | ||
| expect(out).toContain('::group::hide b2://gh-action-logs/g.txt') | ||
| expect(out).toContain(`hidden: g.txt (marker fileId=${result?.fileId})`) | ||
| expect(out).toContain('::endgroup::') | ||
| }) | ||
|
|
||
| it('hide: requires a source and names the action in the error', async () => { | ||
| await expect(hideCommand(fx.bucket, makeInputs('hide', fx))).rejects.toThrow( | ||
| "'source' input is required for 'hide' action (the B2 file name)", | ||
| ) | ||
| }) | ||
|
|
||
| it('unhide: logs the removed marker when one exists', async () => { | ||
| await seedFile(fx, 'u.txt', 'unhide-me') | ||
| await fx.bucket.hideFile('u.txt') | ||
| let result: Awaited<ReturnType<typeof unhideCommand>> | undefined | ||
| const out = await captureStdout(async () => { | ||
| result = await unhideCommand(fx.bucket, makeInputs('unhide', fx, { source: 'u.txt' })) | ||
| }) | ||
| expect(result?.removedMarkerFileId).not.toBeNull() | ||
|
goanpeca marked this conversation as resolved.
Outdated
|
||
| expect(out).toContain('::group::unhide b2://gh-action-logs/u.txt') | ||
| expect(out).toContain( | ||
| `removed hide marker fileId=${result?.removedMarkerFileId}, u.txt is now visible`, | ||
| ) | ||
| }) | ||
|
|
||
| it('unhide: reports a no-op when there is no hide marker', async () => { | ||
| await seedFile(fx, 'v.txt', 'visible') | ||
| let result: Awaited<ReturnType<typeof unhideCommand>> | undefined | ||
| const out = await captureStdout(async () => { | ||
| result = await unhideCommand(fx.bucket, makeInputs('unhide', fx, { source: 'v.txt' })) | ||
| }) | ||
| expect(result?.removedMarkerFileId).toBeNull() | ||
| expect(out).toContain('no hide marker found for v.txt (already visible or non-existent)') | ||
| }) | ||
|
|
||
| it('unhide: requires a source and names the action in the error', async () => { | ||
| await expect(unhideCommand(fx.bucket, makeInputs('unhide', fx))).rejects.toThrow( | ||
| "'source' input is required for 'unhide' action (the B2 file name)", | ||
| ) | ||
| }) | ||
| }) | ||
|
|
||
| describe('tryStat', () => { | ||
| let fx: TestFixture | ||
|
|
||
| beforeEach(async () => { | ||
| fx = await makeFixture('gh-action-try-stat') | ||
| }) | ||
|
|
||
| afterEach(async () => { | ||
| await rm(fx.workDir, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| it('returns Stats for an existing path', async () => { | ||
| const p = join(fx.workDir, 'present.txt') | ||
| await writeFile(p, 'x') | ||
| const s = await tryStat(p) | ||
| expect(s?.isFile()).toBe(true) | ||
| }) | ||
|
|
||
| it('returns undefined instead of throwing for a missing path', async () => { | ||
| const s = await tryStat(join(fx.workDir, 'does', 'not', 'exist.txt')) | ||
| expect(s).toBeUndefined() | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.