File tree 6 files changed +32
-12
lines changed
dev-packages/node-integration-tests
6 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 16
16
"build:types" : " tsc -p tsconfig.types.json" ,
17
17
"clean" : " rimraf -g **/node_modules && run-p clean:script" ,
18
18
"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" ,
21
19
"lint" : " eslint . --format stylish" ,
22
20
"fix" : " eslint . --format stylish --fix" ,
23
21
"type-check" : " tsc" ,
24
- "pretest" : " run-s --silent prisma-v5:init prisma-v6:init" ,
25
22
"test" : " jest --config ./jest.config.js" ,
26
23
"test:watch" : " yarn test --watch"
27
24
},
Original file line number Diff line number Diff line change 7
7
"node" : " >=18"
8
8
},
9
9
"scripts" : {
10
- "db-up" : " docker compose up -d" ,
11
10
"generate" : " prisma generate" ,
12
11
"migrate" : " prisma migrate dev -n sentry-test" ,
13
- "setup" : " run-s --silent db-up generate migrate"
12
+ "setup" : " run-s --silent generate migrate"
14
13
},
15
14
"keywords" : [],
16
15
"author" : " " ,
Original file line number Diff line number Diff line change 1
- import { createRunner } from '../../../utils/runner' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
2
2
3
- describe ( 'Prisma ORM Tests' , ( ) => {
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
+
7
+ describe ( 'Prisma ORM v5 Tests' , ( ) => {
4
8
test ( 'CJS - should instrument PostgreSQL queries from Prisma ORM' , done => {
5
9
createRunner ( __dirname , 'scenario.js' )
10
+ . withDockerCompose ( {
11
+ workingDirectory : [ __dirname ] ,
12
+ readyMatches : [ 'port 5432' ] ,
13
+ setupCommand : 'yarn && yarn setup' ,
14
+ } )
6
15
. expect ( {
7
16
transaction : transaction => {
8
17
expect ( transaction . transaction ) . toBe ( 'Test Transaction' ) ;
Original file line number Diff line number Diff line change 7
7
"node" : " >=18"
8
8
},
9
9
"scripts" : {
10
- "db-up" : " docker compose up -d" ,
11
10
"generate" : " prisma generate" ,
12
11
"migrate" : " prisma migrate dev -n sentry-test" ,
13
- "setup" : " run-s --silent db-up generate migrate"
12
+ "setup" : " run-s --silent generate migrate"
14
13
},
15
14
"keywords" : [],
16
15
"author" : " " ,
Original file line number Diff line number Diff line change 1
1
import type { SpanJSON } from '@sentry/core' ;
2
- import { createRunner } from '../../../utils/runner' ;
2
+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
3
3
4
- describe ( 'Prisma ORM Tests' , ( ) => {
4
+ afterAll ( ( ) => {
5
+ cleanupChildProcesses ( ) ;
6
+ } ) ;
7
+
8
+ describe ( 'Prisma ORM v6 Tests' , ( ) => {
5
9
test ( 'CJS - should instrument PostgreSQL queries from Prisma ORM' , done => {
6
10
createRunner ( __dirname , 'scenario.js' )
11
+ . withDockerCompose ( {
12
+ workingDirectory : [ __dirname ] ,
13
+ readyMatches : [ 'port 5432' ] ,
14
+ setupCommand : 'yarn && yarn setup' ,
15
+ } )
7
16
. expect ( {
8
17
transaction : transaction => {
9
18
expect ( transaction . transaction ) . toBe ( 'Test Transaction' ) ;
Original file line number Diff line number Diff line change 1
1
/* eslint-disable max-lines */
2
- import { spawn , spawnSync } from 'child_process' ;
2
+ import { execSync , spawn , spawnSync } from 'child_process' ;
3
3
import { existsSync } from 'fs' ;
4
4
import { join } from 'path' ;
5
5
import { normalize } from '@sentry/core' ;
@@ -60,6 +60,10 @@ interface DockerOptions {
60
60
* The strings to look for in the output to know that the docker compose is ready for the test to be run
61
61
*/
62
62
readyMatches : string [ ] ;
63
+ /**
64
+ * The command to run after docker compose is up
65
+ */
66
+ setupCommand ?: string ;
63
67
}
64
68
65
69
/**
@@ -96,6 +100,9 @@ async function runDockerCompose(options: DockerOptions): Promise<VoidFunction> {
96
100
if ( text . includes ( match ) ) {
97
101
child . stdout . removeAllListeners ( ) ;
98
102
clearTimeout ( timeout ) ;
103
+ if ( options . setupCommand ) {
104
+ execSync ( options . setupCommand , { cwd, stdio : 'inherit' } ) ;
105
+ }
99
106
resolve ( close ) ;
100
107
}
101
108
}
You can’t perform that action at this time.
0 commit comments