Skip to content

Modernize toolchain and improve test coverage#444

Merged
jasonjoh merged 5 commits into
mainfrom
refresh
Jun 30, 2026
Merged

Modernize toolchain and improve test coverage#444
jasonjoh merged 5 commits into
mainfrom
refresh

Conversation

@jasonjoh

Copy link
Copy Markdown
Member

Summary

Upgrades the project to modern ESM tooling, Node 24, and current dependency versions. Removes unnecessary dependencies, improves test mocking, and fixes a case-sensitivity bug in file exclusion matching.

Changes

Toolchain modernization

  • Migrate from CommonJS to native ESM ( "type": "module" ,  .js  import extensions,  nodenext  module resolution)
  • Upgrade Node runtime from  node20  to  node24  in  action.yml 
  • Replace  @vercel/ncc  bundler with Rollup
  • Replace  .eslintrc.json  with ESLint flat config ( eslint.config.js )
  • Upgrade major dependencies: TypeScript 6, ESLint 10, Jest 30,  @actions/core  3,  @actions/github  9, minimatch 10
  • Update  tsconfig.json  to target ES2022 with  nodenext  resolution
  • Add copyright headers to all source files
  • Bump version to 1.0.15

Test improvements

  • Remove  fetch-mock ,  node-fetch , and  @types/node-fetch  dependencies
  • Replace  fetch-mock  with  jest.fn()  + native  Response  objects injected via Octokit's  request: { fetch }  option
  • Fix  jest.config.js  to use proper ESM  export default  instead of  module.exports 
  • Add 6 new tests covering previously untested paths:
    • checkFilesForCrlf  with exclusion patterns
    • isFileExcluded  with empty array (default fallback)
    • checkFilesForCrlf  with empty file list
    • generatePrComment  with a single file
  • Bare  \r  (old Mac-style) not flagged as CRLF
  • Case-insensitive file extension matching

Bug fix

  • File exclusion patterns are now case-insensitive ( { nocase: true }  passed to  minimatch ), so patterns like  /.png  also match  .PNG ,  .Png , etc.

Documentation

  • Add .github/copilot-instructions.md  for AI-assisted development context

Testing

All 14 tests pass ( npm test ).

jasonjoh and others added 5 commits June 19, 2026 14:26
- Migrate from CommonJS to ESM (type: module, .js import extensions)
- Upgrade Node runtime from node20 to node24 in action.yml
- Replace @vercel/ncc bundler with Rollup
- Replace .eslintrc.json with flat config (eslint.config.js)
- Upgrade all major dependencies: TypeScript 6, ESLint 10, Jest 30,
  @actions/core 3, @actions/github 9, minimatch 10, fetch-mock 12
- Update tsconfig to target es2022 with nodenext module resolution
- Add copyright headers to all source files
- Add Jest ESM support via cross-env and ts-jest-resolver
- Add .github/copilot-instructions.md for AI-assisted development
- Bump version to 1.0.15

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add nocase option to minimatch in isFileExcluded so patterns like
  **/**.png also match .PNG, .Png, etc.
- Replace fetch-mock with jest.fn() + native Response for test mocking
- Remove fetch-mock, node-fetch, and @types/node-fetch dependencies
- Fix jest.config.js to use ESM export instead of module.exports
- Add tests for: exclusion integration in checkFilesForCrlf, empty
  exclude array fallback, empty file list, single-file PR comment,
  bare CR not flagged, and case-insensitive exclusion
- Update copilot-instructions.md to reflect new test mocking approach

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jasonjoh
jasonjoh merged commit 961511d into main Jun 30, 2026
5 checks passed
@jasonjoh
jasonjoh deleted the refresh branch June 30, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants