Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`replaceEsm` breaks usage of mongo db

Đang mở
#488 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, mongodb, node.js
Lĩnh vực
databases, testing-qa

Hướng nghiên cứu

Start with the linked minimal repository and reproduce the interaction between replaceEsm, imports in beforeEach, and Mongo queries. Compare calls from module A with calls from module C, then confirm the fix by showing that module A's queries return results while its dependency is replaced.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

Using replaceEsm breaks usage of Mongo in the files under test

Issue

See repo for details. I have a module, A with a dependency on another module, B. Module A queries Mongo DB. When testing module A, I call replaceEsm('path/to/B') and this causes all queries to Mongo in module A to return nothing. However, I also have another module C which also queries Mongo. If I make calls to module C from the tests of module A, the mongo queries work as expected.

It seems there might be an issue with replaceEsm + imports in beforeEach + mongo db.

Environment
  • node -v output: v17.6.0
  • npm -v (or yarn --version) output: 8.5.1
  • npm ls testdouble (or yarn list testdouble) version:
    example@ /Users/paymahn/code/tripvector/example
    └── [email protected]
Example Repo

Here's a minimal repo: https://github.com/paymog/testdouble-example

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
140
Merge trung bình
5 giờ 55 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của testdouble/testdouble.js

Tất cả issue của testdouble/testdouble.js

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.