Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Nov 15, 2025

Fixes failing tests in gcsAPI.test.ts and changelog.test.ts by correcting fs module mocking, adding author data, quoting YAML titles, and refining PR exclusion logic.

The gcsAPI.test.ts failures were due to a conflict between jest.spyOn and a partial fs module mock for existsSync. This is resolved by explicitly mocking existsSync within the fs mock. For changelog.test.ts, issues included missing author fields, YAML parsing errors with special characters in titles, and a bug where category-level excluded PRs were incorrectly falling into the 'Other' category instead of being fully omitted. The fix introduces a dedicated function to handle these complete exclusions.


Open in Cursor Open in Web

This commit refactors the changelog generation logic to correctly handle category-level exclusions and improves the mocking of the `fs` module by using `jest.requireActual` for `readFileSync`. It also updates the `gcsAPI` tests to use the mocked `fs.existsSync`.

Co-authored-by: burak.kaya <burak.kaya@sentry.io>
@cursor
Copy link
Contributor

cursor bot commented Nov 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

- Remove npm-generated package-lock.json file
- Regenerate yarn.lock with current dependencies
- Project uses yarn as the package manager
Fixed multiple TypeScript compilation errors and dependency issues:

**TypeScript Fixes:**
- Fixed github.ts: Changed Promise resolve callback to match expected signature
- Fixed awsLambdaLayerManager.ts:
  - Added Runtime import and cast CompatibleRuntimes to Runtime[]
  - Cast headers to Record<string, string> for fetch compatibility
- Fixed registry.ts: Added explicit RemoteArtifact type to mapLimit callback
- Fixed brew.ts: Added RemoteArtifact import and type annotation

**Configuration Fixes:**
- tsconfig.build.json: Added noImplicitUseStrict: false to override deprecated parent config option
- jest.config.js: Added transformIgnorePatterns for ESM modules (dot-prop, configstore)
- package.json: Pinned dot-prop to ^5.3.0 to avoid ESM-only version 10.x that breaks Jest

**Test Results:**
- All 38 test suites passing ✅
- 369 tests passing, 1 skipped (370 total)
- 28 snapshots passing
@BYK BYK marked this pull request as ready for review November 15, 2025 23:16
@BYK BYK merged commit eb4522b into cursor/migrate-changelog-to-github-releases-51a3 Nov 15, 2025
6 checks passed
@BYK BYK deleted the cursor/fix-failing-tests-809c branch November 15, 2025 23:16
BYK added a commit that referenced this pull request Nov 24, 2025
* Refactor changelog generation to use release.yml for categorization

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Fix: Handle ENOENT error and improve changelog generation

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor: Improve changelog generation tests

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Fix failing tests (#625)

* Refactor: Improve changelog generation and mock fs

This commit refactors the changelog generation logic to correctly handle category-level exclusions and improves the mocking of the `fs` module by using `jest.requireActual` for `readFileSync`. It also updates the `gcsAPI` tests to use the mocked `fs.existsSync`.

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* chore: Remove package-lock.json and regenerate yarn.lock

- Remove npm-generated package-lock.json file
- Regenerate yarn.lock with current dependencies
- Project uses yarn as the package manager

* fix: Resolve all TypeScript compilation and test failures

Fixed multiple TypeScript compilation errors and dependency issues:

**TypeScript Fixes:**
- Fixed github.ts: Changed Promise resolve callback to match expected signature
- Fixed awsLambdaLayerManager.ts:
  - Added Runtime import and cast CompatibleRuntimes to Runtime[]
  - Cast headers to Record<string, string> for fetch compatibility
- Fixed registry.ts: Added explicit RemoteArtifact type to mapLimit callback
- Fixed brew.ts: Added RemoteArtifact import and type annotation

**Configuration Fixes:**
- tsconfig.build.json: Added noImplicitUseStrict: false to override deprecated parent config option
- jest.config.js: Added transformIgnorePatterns for ESM modules (dot-prop, configstore)
- package.json: Pinned dot-prop to ^5.3.0 to avoid ESM-only version 10.x that breaks Jest

**Test Results:**
- All 38 test suites passing ✅
- 369 tests passing, 1 skipped (370 total)
- 28 snapshots passing

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Refactor changelog generation to use GitHub PR format

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor changelog generation to use Sets for exclusions

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor: Normalize release config exclusions to use empty sets

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor: Simplify changelog normalization and matching logic

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor: Simplify changelog exclusion logic and update yarn.lock

This commit refactors the changelog exclusion logic to be more concise and removes unnecessary checks. It also updates the yarn.lock file to reflect the latest dependency versions.

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Checkpoint before follow-up message

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* Refactor changelog generation and update tsconfig

Co-authored-by: burak.kaya <burak.kaya@sentry.io>

* build(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 (#624)

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump js-yaml from 3.13.1 to 4.1.1 (#626)

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.13.1 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.13.1...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Upgrade sentry/node to latest (#627)

* chore: Upgrade sentry/node to latest

* fix

* fix: Upgrade Jest to 29.7.0 to fix ESM/CJS compatibility with Node 22

The older Jest version had issues with strip-ansi ESM module resolution
when running on Node.js 22. Also added a resolution to pin strip-ansi
in @jest/reporters to the CJS-compatible version.

* fix: Remove corrupted 'yarn' prefix from test file

Rebase artifact left 'yarn' prefix on a line in the test file.

* fix: Replace Set.intersection() with loop for Node 20 compatibility

Set.intersection() is only available in Node 22+. Use a loop to check
for excluded labels instead.

* fix: Strip redundant PR number suffix from PR titles in changelog

When formatting PR entries for the changelog, the PR number like '(#123)'
at the end of the title is now stripped since the PR link is already
included at the end of the entry.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

3 participants