File tree Expand file tree Collapse file tree 6 files changed +32
-12
lines changed
dev-packages/node-integration-tests Expand file tree Collapse file tree 6 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 1616 "build:types" : " tsc -p tsconfig.types.json" ,
1717 "clean" : " rimraf -g **/node_modules && run-p clean:script" ,
1818 "clean:script" : " node scripts/clean.js" ,
19- "prisma-v5:init" : " cd suites/tracing/prisma-orm-v5 && yarn && yarn setup" ,
20- "prisma-v6:init" : " cd suites/tracing/prisma-orm-v6 && yarn && yarn setup" ,
2119 "lint" : " eslint . --format stylish" ,
2220 "fix" : " eslint . --format stylish --fix" ,
2321 "type-check" : " tsc" ,
24- "pretest" : " run-s --silent prisma-v5:init prisma-v6:init" ,
2522 "test" : " jest --config ./jest.config.js" ,
2623 "test:watch" : " yarn test --watch"
2724 },
Original file line number Diff line number Diff line change 77 "node" : " >=18"
88 },
99 "scripts" : {
10- "db-up" : " docker compose up -d" ,
1110 "generate" : " prisma generate" ,
1211 "migrate" : " prisma migrate dev -n sentry-test" ,
13- "setup" : " run-s --silent db-up generate migrate"
12+ "setup" : " run-s --silent generate migrate"
1413 },
1514 "keywords" : [],
1615 "author" : " " ,
Original file line number Diff line number Diff line change 1- import { createRunner } from '../../../utils/runner' ;
1+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
22
3- describe ( 'Prisma ORM Tests' , ( ) => {
3+ afterAll ( ( ) => {
4+ cleanupChildProcesses ( ) ;
5+ } ) ;
6+
7+ describe ( 'Prisma ORM v5 Tests' , ( ) => {
48 test ( 'CJS - should instrument PostgreSQL queries from Prisma ORM' , done => {
59 createRunner ( __dirname , 'scenario.js' )
10+ . withDockerCompose ( {
11+ workingDirectory : [ __dirname ] ,
12+ readyMatches : [ 'port 5432' ] ,
13+ setupCommand : 'yarn && yarn setup' ,
14+ } )
615 . expect ( {
716 transaction : transaction => {
817 expect ( transaction . transaction ) . toBe ( 'Test Transaction' ) ;
Original file line number Diff line number Diff line change 77 "node" : " >=18"
88 },
99 "scripts" : {
10- "db-up" : " docker compose up -d" ,
1110 "generate" : " prisma generate" ,
1211 "migrate" : " prisma migrate dev -n sentry-test" ,
13- "setup" : " run-s --silent db-up generate migrate"
12+ "setup" : " run-s --silent generate migrate"
1413 },
1514 "keywords" : [],
1615 "author" : " " ,
Original file line number Diff line number Diff line change 11import type { SpanJSON } from '@sentry/core' ;
2- import { createRunner } from '../../../utils/runner' ;
2+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
33
4- describe ( 'Prisma ORM Tests' , ( ) => {
4+ afterAll ( ( ) => {
5+ cleanupChildProcesses ( ) ;
6+ } ) ;
7+
8+ describe ( 'Prisma ORM v6 Tests' , ( ) => {
59 test ( 'CJS - should instrument PostgreSQL queries from Prisma ORM' , done => {
610 createRunner ( __dirname , 'scenario.js' )
11+ . withDockerCompose ( {
12+ workingDirectory : [ __dirname ] ,
13+ readyMatches : [ 'port 5432' ] ,
14+ setupCommand : 'yarn && yarn setup' ,
15+ } )
716 . expect ( {
817 transaction : transaction => {
918 expect ( transaction . transaction ) . toBe ( 'Test Transaction' ) ;
Original file line number Diff line number Diff line change 11/* eslint-disable max-lines */
2- import { spawn , spawnSync } from 'child_process' ;
2+ import { execSync , spawn , spawnSync } from 'child_process' ;
33import { existsSync } from 'fs' ;
44import { join } from 'path' ;
55import { normalize } from '@sentry/core' ;
@@ -60,6 +60,10 @@ interface DockerOptions {
6060 * The strings to look for in the output to know that the docker compose is ready for the test to be run
6161 */
6262 readyMatches : string [ ] ;
63+ /**
64+ * The command to run after docker compose is up
65+ */
66+ setupCommand ?: string ;
6367}
6468
6569/**
@@ -96,6 +100,9 @@ async function runDockerCompose(options: DockerOptions): Promise<VoidFunction> {
96100 if ( text . includes ( match ) ) {
97101 child . stdout . removeAllListeners ( ) ;
98102 clearTimeout ( timeout ) ;
103+ if ( options . setupCommand ) {
104+ execSync ( options . setupCommand , { cwd, stdio : 'inherit' } ) ;
105+ }
99106 resolve ( close ) ;
100107 }
101108 }
You can’t perform that action at this time.
0 commit comments