Skip to content

chore(deps): replace supertest with @eggjs/supertest#5483

Merged
fengmk2 merged 2 commits intonextfrom
replace-supertest
Sep 14, 2025
Merged

chore(deps): replace supertest with @eggjs/supertest#5483
fengmk2 merged 2 commits intonextfrom
replace-supertest

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Sep 14, 2025

Replace the external supertest dependency with the internal @eggjs/supertest package across the monorepo. This change uses the workspace's own supertest implementation instead of the external package.

  • Remove supertest and @types/supertest from pnpm catalog
  • Update package.json files in koa and egg-bin packages
  • Update all import statements from 'supertest' to '@eggjs/supertest'

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Migrated HTTP testing client to the internal @eggjs/supertest across the workspace.
    • Removed external supertest and its type definitions from workspace configuration and package dependencies.
  • Tests

    • Updated test suites to import the request helper from @eggjs/supertest.
    • No changes to test behavior, assertions, or execution.

Replace the external supertest dependency with the internal @eggjs/supertest package across the monorepo.
This change uses the workspace's own supertest implementation instead of the external package.

- Remove supertest and @types/supertest from pnpm catalog
- Update package.json files in koa and egg-bin packages
- Update all import statements from 'supertest' to '@eggjs/supertest'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fengmk2 fengmk2 requested a review from Copilot September 14, 2025 08:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 14, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Replaced external supertest and @types/supertest references with the workspace package @eggjs/supertest and updated test imports from import request from 'supertest' to import { request } from '@eggjs/supertest'. No runtime logic or test control flow changed.

Changes

Cohort / File(s) Summary
Dependency migration to workspace @eggjs/supertest
packages/koa/package.json, tools/egg-bin/package.json, pnpm-workspace.yaml
Removed supertest and @types/supertest catalog entries; added/replaced with @eggjs/supertest as workspace:*.
Koa tests import switch
packages/koa/test/application/* (e.g., .../context.test.ts, .../currentContext.test.ts, .../index.test.ts, .../request.test.ts, .../respond.test.ts, .../response.test.ts, .../use.test.ts), packages/koa/test/context/* (.../cookies.test.ts, .../onerror.test.ts, .../state.test.ts), packages/koa/test/response/* (.../attachment.test.ts, .../flushHeaders.test.ts, .../header.test.ts, .../redirect.test.ts, .../status.test.ts)
Switched imports from import request from 'supertest' to import { request } from '@eggjs/supertest'. No other code changes.
Tooling fixture test import switch
tools/egg-bin/test/fixtures/example-ts-cluster/test/index.test.ts
Replaced default supertest import with named { request } from @eggjs/supertest.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

Hoppity hop through tests I tread,
Swapped my trails from super to egg instead.
Named requests now nibble in line,
Workspace carrots—oh how they shine! 🥕
CI burrows hum, greens all aligned.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore(deps): replace supertest with @eggjs/supertest" succinctly and accurately summarizes the PR's primary change — swapping the external supertest dependency for the internal @eggjs/supertest across the monorepo — and follows conventional commit style, making the main intent clear to reviewers at a glance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4038e5 and f896c83.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • pnpm-workspace.yaml (0 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request centralizes the testing utility by migrating from the external supertest package to an internal @eggjs/supertest workspace package. This change ensures consistency in testing practices across the monorepo and leverages a unified, internally managed version of the testing library. The update involves adjusting package dependencies and refactoring import paths in test files.

Highlights

  • Dependency Replacement: The external supertest and its corresponding @types/supertest dependencies have been replaced with the internal @eggjs/supertest package across the monorepo.
  • Package Configuration Updates: The package.json files for packages/koa and tools/egg-bin have been updated to reflect the new workspace dependency on @eggjs/supertest and remove the old supertest references.
  • Import Statement Refactoring: All relevant test files within packages/koa and tools/egg-bin have been updated to change their import statements from import request from 'supertest' to import { request } from '@eggjs/supertest'.
  • Lockfile Synchronization: The pnpm-lock.yaml and pnpm-workspace.yaml files have been updated to remove the old supertest and @types/supertest entries from the catalog and package definitions, and to include the new workspace dependency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the external supertest dependency with the internal @eggjs/supertest package across the monorepo to standardize on the workspace's own supertest implementation.

Key changes:

  • Remove supertest and @types/supertest from the pnpm catalog
  • Update package dependencies in koa and egg-bin packages
  • Change import statements from default imports to named imports

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.

File Description
pnpm-workspace.yaml Remove supertest and @types/supertest from catalog dependencies
packages/koa/package.json Replace @types/supertest and supertest with @eggjs/supertest workspace dependency
tools/egg-bin/package.json Replace @types/supertest and supertest with @eggjs/supertest workspace dependency
Multiple test files Update import statements from default import to named import syntax
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@cloudflare-workers-and-pages
Copy link

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: c4038e5
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages
Copy link

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: c4038e5
Status:🚫  Build failed.

View logs

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the supertest dependency with the internal @eggjs/supertest package. The changes are mostly mechanical, updating package configurations and import statements. My main feedback is to use the default import for @eggjs/supertest instead of the named import. The default export is designed to be a fully compatible drop-in replacement for supertest, including the .agent() method, which the named request export lacks. This will ensure better compatibility and prevent potential issues in the future.

# Conflicts:
#	pnpm-lock.yaml
#	pnpm-workspace.yaml
@fengmk2 fengmk2 merged commit 874ecb3 into next Sep 14, 2025
5 of 18 checks passed
@fengmk2 fengmk2 deleted the replace-supertest branch September 14, 2025 09:10
@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.31%. Comparing base (e57b76e) to head (f896c83).
⚠️ Report is 7 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5483      +/-   ##
==========================================
- Coverage   76.24%   75.31%   -0.94%     
==========================================
  Files         104       95       -9     
  Lines        5696     5554     -142     
  Branches     1196     1178      -18     
==========================================
- Hits         4343     4183     -160     
- Misses       1183     1199      +16     
- Partials      170      172       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant