-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test Visibility Github Action via dd-trace-js
is failing due to import-in-the-middle
dependency
#4713
Comments
already created an issue to track why higher versions fail. see DataDog/dd-trace-js#4713
hey! Thanks for reporting @karrui. I'll try to reproduce and let you know. What |
We are using vitest v2.1.1 (latest) |
already created an issue to track why higher versions fail. see DataDog/dd-trace-js#4713
hey @karrui, I can't seem to be able to reproduce with a simple import { describe, it, expect, beforeAll, afterAll } from 'vitest'
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient();
describe('User Model', () => {
beforeAll(async () => {
// Clean up the database before running tests
await prisma.user.deleteMany();
});
afterAll(async () => {
// Disconnect Prisma Client after tests are done
await prisma.$disconnect();
});
it('should create a new user', async () => {
const user = await prisma.user.create({
data: {
name: 'Alice',
email: '[email protected]',
},
});
expect(user).toHaveProperty('id');
expect(user.name).toBe('Alice');
expect(user.email).toBe('[email protected]');
}); "devDependencies": {
"@types/node": "^22.5.5",
"dd-trace": "^5.22.0",
"prisma": "^5.19.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vitest": "^2.1.1"
},
"dependencies": {
"@prisma/client": "^5.19.1"
}, running with
which is what Test seems to run correctly:
What could I be missing? |
Running the series of commands in
results in the following error
EDIT: Opened a PR to hopefully fix that |
This does not seem to be isolated to that repository; another template repository my organisation uses for a bunch of applications is also affected. Only started today with no changes to the test command! See the recent commit checks https://github.com/opengovsg/starter-kit/commits/main/ failing on the EDIT: Traced to |
Suspect this is due to EDIT: Confirmed due to v1.11.1 update. Different issue than the one in the beginning, but this might be more important to fix. Overridden dependency for dd-trace in package.json:
All tests pass (while using Prisma v5.10.2) |
thanks for the investigation! That's really helpful. As a quicker fix I pushed #4732 |
|
@karrui a new release just went out with your iitm fix: https://github.com/DataDog/dd-trace-js/releases/tag/v5.23.0 this fixes your second issue but I believe you're still facing the first one? Or am I wrong? |
Will update and test to see if the first issue still happens |
Confirming that latest dd-trace still has issues with iitm and Prisma (version v5.20.0); unsure why. (node:95423) Error: 'import-in-the-middle' failed to wrap 'file:///path/to/project/node_modules/@prisma/client/default.js' To replicate: Please pull https://github.com/opengovsg/starter-kit, and run npm i
npm i prisma@latest @prisma/client@latest
npm i dd-trace
npm run generate
NODE_OPTIONS='-r dd-trace/ci/init --import dd-trace/register.js' npm run test-dev:vitest |
hey @karrui thanks, I can reproduce. There seems to be a bug in module.exports = { ...require('#main-entry-point') } to const result = require('#main-entry-point')
module.exports = { ...result } the We'll check this internally and I'll also create an issue in |
FYI: I've created nodejs/import-in-the-middle#157, in case you want to follow it |
Might be related to this NewRelic issue: newrelic/node-newrelic#1984
Using the latest Prisma v5.18.0 results in this error when running vitest tests in Github Action (with
datadog/test-visibility-github-action@v1
):Same error also happens when running locally, so it is not the action causing this.
Unsure if this is a fix on
dd-trace
's end,import-in-the-middle
, or Prisma.Now back testing to see which version first caused dd-trace to stop working.EDIT: First apeared in v5.11.0 of Prisma.
This error does not happen in v5.10.2 of Prisma.
The text was updated successfully, but these errors were encountered: