Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6a1804f
add reference implementation methods
Ma11hewThomas Jan 25, 2026
e56e12e
refactor: update GitHub Actions workflow for enhanced testing and lin…
Ma11hewThomas Jan 25, 2026
aaab19a
Regenerate package-lock.json with all platform binaries for Node 24
Ma11hewThomas Jan 25, 2026
a10846e
fix: remove Node.js 24.x from CI matrix
Ma11hewThomas Jan 25, 2026
0f89c38
update test cases and examples for improved validation and reporting
Ma11hewThomas Jan 25, 2026
fe80acb
streamline stdout formatting in comprehensive.json
Ma11hewThomas Jan 25, 2026
feffc8d
Migrate to ES modules for ESM compatibility with ctrf
Ma11hewThomas Jan 25, 2026
3239612
update TypeScript configuration for improved compatibility and structure
Ma11hewThomas Jan 25, 2026
81d36d2
update CI configuration to include Node.js 24.x in the test matrix
Ma11hewThomas Jan 25, 2026
d71a65b
remove Node.js 24.x from the test matrix in CI configuration
Ma11hewThomas Jan 25, 2026
3596e9d
refactor: update README for clarity and usage instructions; add CLI b…
Ma11hewThomas Jan 25, 2026
5297e9c
refactor: update add-insights to take current report and historical r…
Ma11hewThomas Jan 25, 2026
3797580
feat: exclude current report from historical reports analysis if same…
Ma11hewThomas Jan 25, 2026
b74f430
fix: use case-insensitive path comparison for cross-platform compatib…
Ma11hewThomas Jan 25, 2026
41d3a03
refactor: remove inline comments for self-documenting code
Ma11hewThomas Jan 25, 2026
1140f72
refactor: centralize exit codes in shared constants module
Ma11hewThomas Jan 25, 2026
e8a086e
refactor: remove inline comments from all test files
Ma11hewThomas Jan 25, 2026
348490d
test: add comprehensive test coverage for flaky, filter, validate, an…
Ma11hewThomas Jan 25, 2026
863ce81
enhance release workflow to handle prerelease versions and npm tagging
Ma11hewThomas Jan 25, 2026
c24be79
remove .DS_Store file and update .gitignore to include it
Ma11hewThomas Jan 25, 2026
8590b75
add Contributor Covenant Code of Conduct
Ma11hewThomas Jan 25, 2026
3d5a777
add CODE_OF_CONDUCT.md to .prettierignore
Ma11hewThomas Jan 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
129 changes: 113 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,121 @@
name: Build
name: Build and Test

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
testing:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.19.0, 21.x, 22.x, 23.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Run tests
run: npm test

- name: Test CLI - Merge
run: node dist/cli.js merge test-reports

- name: Test CLI - Validate
run: node dist/cli.js validate examples/minimal.json

- name: Test CLI - Validate Strict
run: node dist/cli.js validate-strict examples/minimal.json

- name: Test CLI - Flaky
run: node dist/cli.js flaky examples/with-retries.json

- name: Test CLI - Generate Test IDs
run: node dist/cli.js generate-test-ids examples/minimal.json

- name: Test CLI - Generate Report ID
run: node dist/cli.js generate-report-id examples/minimal.json

- name: Test CLI - Add Insights
run: node dist/cli.js add-insights examples/minimal.json examples

- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: "./ctrf/*.json"
summary-delta-report: true
github-report: true
failed-report: true
flaky-report: true
insights-report: true
fail-rate-report: true
flaky-rate-report: true
slowest-report: true
previous-results-report: true
upload-artifact: true
artifact-name: ctrf-test-report-${{ matrix.node-version }}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()

lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19.0"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Type check
run: npx tsc --noEmit

- name: Run linter
run: npm run lint:check

- name: Check formatting
run: npm run format:check

security:
Comment on lines +76 to +100

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To fix this, explicitly define a permissions block so that the GITHUB_TOKEN used by jobs has only the minimal required scopes. The lint and security jobs only read the code and run local commands, so contents: read is sufficient. The test job uses ctrf-io/github-test-reporter@v1 with github-report: true and similar options; such reporting actions typically need to read PRs and statuses and may need to write a PR comment or summary. A conservative and still least-privilege choice is to give that job contents: read and pull-requests: write (enough to post PR comments) while keeping other scopes absent.

The single best way with minimal functional change is:

  • Add a top-level permissions: contents: read so that all jobs default to read-only repository access.
  • Override for the test job with a job-level permissions block that grants contents: read and pull-requests: write. This keeps lint and security as read-only, and gives test exactly what it likely needs for GitHub reporting.

All changes are confined to .github/workflows/main.yaml by inserting the new permissions blocks without altering any existing steps.

Suggested changeset 1
.github/workflows/main.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -4,8 +4,14 @@
   push:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   test:
+    permissions:
+      contents: read
+      pull-requests: write
     runs-on: ubuntu-latest
 
     strategy:
EOF
@@ -4,8 +4,14 @@
push:
pull_request:

permissions:
contents: read

jobs:
test:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest

strategy:
Copilot is powered by AI and may make mistakes. Always verify output.
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
- name: Merge
run: npx ctrf-cli merge test-reports
- name: Flaky
run: npx ctrf-cli flaky test-reports/ctrf-report-one.json
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19.0"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run security audit
run: npm audit --audit-level=moderate

- name: Check for known vulnerabilities
run: npx audit-ci --moderate

Comment on lines +101 to +121

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

In general, the fix is to explicitly declare a permissions block for the workflow or each job so that the GITHUB_TOKEN has only the minimal capabilities required. Since all jobs in this workflow only need to read repository contents and use Actions, we can safely set permissions: contents: read at the workflow root, which will apply to all jobs. If at some point a job needs additional scopes (for example, checks: write or pull-requests: write), it can override or extend permissions at the job level.

The best minimal change here is to add a workflow‑level permissions block directly under the name: Build and Test line in .github/workflows/main.yaml. Based on the current steps, contents: read is sufficient: all interactions with GitHub (checkout, reading code, reading existing artifacts) only require read access; the third‑party reporter action typically only needs to post check results or summaries via the provided token, which many implementations can do with contents: read plus the default checks/reporting behavior granted by GitHub when contents: read is set (if a future failure indicates it needs e.g. checks: write, that can be added then). No additional imports or methods are required, just the YAML change.

Concretely:

  • Edit .github/workflows/main.yaml.
  • Insert a permissions: block after line 1 (name: Build and Test) with contents: read.
  • Leave the rest of the workflow unchanged.
Suggested changeset 1
.github/workflows/main.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -1,4 +1,6 @@
 name: Build and Test
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: Build and Test
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-*'
permissions:
contents: write
id-token: write
Expand Down Expand Up @@ -34,10 +35,23 @@ jobs:
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Determine npm tag and release type
id: release-info
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" =~ -.*$ ]]; then
echo "npm_tag=next" >> $GITHUB_OUTPUT
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "npm_tag=latest" >> $GITHUB_OUTPUT
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi

- name: Publish to npm
run: npm publish --provenance --access public
run: npm publish --provenance --access public --tag ${{ steps.release-info.outputs.npm_tag }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ steps.release-info.outputs.is_prerelease == 'true' }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist
node_modules
coverage
ctrf
.DS_Store
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ community-reports/
.exlintrc.js
README.md
docs/
CODE_OF_CONDUCT.md
119 changes: 119 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
Matthew Poulton-White.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Matthew Thomas
Copyright (c) 2024 Matthew Poulton-White

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading