@@ -17,6 +17,8 @@ const { FakeCiVisIntake } = require('./ci-visibility-intake')
1717const {
1818 TEST_SESSION_CODE_COVERAGE_ENABLED ,
1919 TEST_SESSION_ITR_SKIPPING_ENABLED ,
20+ TEST_MODULE_CODE_COVERAGE_ENABLED ,
21+ TEST_MODULE_ITR_SKIPPING_ENABLED ,
2022 TEST_ITR_TESTS_SKIPPED
2123} = require ( '../packages/dd-trace/src/plugins/util/test' )
2224
@@ -227,7 +229,7 @@ testFrameworks.forEach(({
227229 assert . propertyVal ( packfileRequest . headers , 'dd-api-key' , '1' )
228230
229231 const eventTypes = eventsRequest . payload . events . map ( event => event . type )
230- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
232+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
231233 const numSuites = eventTypes . reduce (
232234 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
233235 )
@@ -276,7 +278,7 @@ testFrameworks.forEach(({
276278 assert . exists ( coveragePayload . content . coverages [ 0 ] . test_suite_id )
277279
278280 const eventTypes = eventsRequest . payload . events . map ( event => event . type )
279- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
281+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
280282 const numSuites = eventTypes . reduce (
281283 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
282284 )
@@ -307,11 +309,15 @@ testFrameworks.forEach(({
307309 receiver . assertPayloadReceived ( ( { headers, payload } ) => {
308310 assert . propertyVal ( headers , 'dd-api-key' , '1' )
309311 const eventTypes = payload . events . map ( event => event . type )
310- assert . includeMembers ( eventTypes , [ 'test' , 'test_session_end' , 'test_suite_end' ] )
312+ assert . includeMembers ( eventTypes , [ 'test' , 'test_session_end' , 'test_module_end' , ' test_suite_end'] )
311313 const testSession = payload . events . find ( event => event . type === 'test_session_end' ) . content
312314 assert . propertyVal ( testSession . meta , TEST_ITR_TESTS_SKIPPED , 'false' )
313315 assert . propertyVal ( testSession . meta , TEST_SESSION_CODE_COVERAGE_ENABLED , 'false' )
314316 assert . propertyVal ( testSession . meta , TEST_SESSION_ITR_SKIPPING_ENABLED , 'false' )
317+ const testModule = payload . events . find ( event => event . type === 'test_module_end' ) . content
318+ assert . propertyVal ( testModule . meta , TEST_ITR_TESTS_SKIPPED , 'false' )
319+ assert . propertyVal ( testModule . meta , TEST_MODULE_CODE_COVERAGE_ENABLED , 'false' )
320+ assert . propertyVal ( testModule . meta , TEST_MODULE_ITR_SKIPPING_ENABLED , 'false' )
315321 } , ( { url } ) => url === '/api/v2/citestcycle' ) . then ( ( ) => done ( ) ) . catch ( done )
316322
317323 childProcess = exec (
@@ -354,7 +360,7 @@ testFrameworks.forEach(({
354360 event . content . resource === 'ci-visibility/test/ci-visibility-test.js.ci visibility can report tests'
355361 )
356362 assert . notExists ( skippedTest )
357- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
363+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
358364 const numSuites = eventTypes . reduce (
359365 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
360366 )
@@ -363,6 +369,10 @@ testFrameworks.forEach(({
363369 assert . propertyVal ( testSession . meta , TEST_ITR_TESTS_SKIPPED , 'true' )
364370 assert . propertyVal ( testSession . meta , TEST_SESSION_CODE_COVERAGE_ENABLED , 'true' )
365371 assert . propertyVal ( testSession . meta , TEST_SESSION_ITR_SKIPPING_ENABLED , 'true' )
372+ const testModule = eventsRequest . payload . events . find ( event => event . type === 'test_module_end' ) . content
373+ assert . propertyVal ( testModule . meta , TEST_ITR_TESTS_SKIPPED , 'true' )
374+ assert . propertyVal ( testModule . meta , TEST_MODULE_CODE_COVERAGE_ENABLED , 'true' )
375+ assert . propertyVal ( testModule . meta , TEST_MODULE_ITR_SKIPPING_ENABLED , 'true' )
366376 done ( )
367377 } ) . catch ( done )
368378
@@ -394,7 +404,7 @@ testFrameworks.forEach(({
394404 assert . propertyVal ( headers , 'dd-api-key' , '1' )
395405 const eventTypes = payload . events . map ( event => event . type )
396406 // because they are not skipped
397- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
407+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
398408 const numSuites = eventTypes . reduce (
399409 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
400410 )
@@ -403,6 +413,10 @@ testFrameworks.forEach(({
403413 assert . propertyVal ( testSession . meta , TEST_ITR_TESTS_SKIPPED , 'false' )
404414 assert . propertyVal ( testSession . meta , TEST_SESSION_CODE_COVERAGE_ENABLED , 'true' )
405415 assert . propertyVal ( testSession . meta , TEST_SESSION_ITR_SKIPPING_ENABLED , 'true' )
416+ const testModule = payload . events . find ( event => event . type === 'test_module_end' ) . content
417+ assert . propertyVal ( testModule . meta , TEST_ITR_TESTS_SKIPPED , 'false' )
418+ assert . propertyVal ( testModule . meta , TEST_MODULE_CODE_COVERAGE_ENABLED , 'true' )
419+ assert . propertyVal ( testModule . meta , TEST_MODULE_ITR_SKIPPING_ENABLED , 'true' )
406420 } , ( { url } ) => url === '/api/v2/citestcycle' ) . then ( ( ) => done ( ) ) . catch ( done )
407421
408422 childProcess = exec (
@@ -436,7 +450,7 @@ testFrameworks.forEach(({
436450 assert . propertyVal ( headers , 'dd-api-key' , '1' )
437451 const eventTypes = payload . events . map ( event => event . type )
438452 // because they are not skipped
439- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
453+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
440454 const numSuites = eventTypes . reduce (
441455 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
442456 )
@@ -520,7 +534,7 @@ testFrameworks.forEach(({
520534 assert . propertyVal ( packfileRequest . headers , 'x-datadog-evp-subdomain' , 'api' )
521535
522536 const eventTypes = eventsRequest . payload . events . map ( event => event . type )
523- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
537+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
524538 const numSuites = eventTypes . reduce (
525539 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
526540 )
@@ -570,7 +584,7 @@ testFrameworks.forEach(({
570584 assert . exists ( coveragePayload . content . coverages [ 0 ] . test_suite_id )
571585
572586 const eventTypes = eventsRequest . payload . events . map ( event => event . type )
573- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
587+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
574588 const numSuites = eventTypes . reduce (
575589 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
576590 )
@@ -602,7 +616,7 @@ testFrameworks.forEach(({
602616 assert . notProperty ( headers , 'dd-api-key' )
603617 assert . propertyVal ( headers , 'x-datadog-evp-subdomain' , 'citestcycle-intake' )
604618 const eventTypes = payload . events . map ( event => event . type )
605- assert . includeMembers ( eventTypes , [ 'test' , 'test_session_end' , 'test_suite_end' ] )
619+ assert . includeMembers ( eventTypes , [ 'test' , 'test_session_end' , 'test_module_end' , ' test_suite_end'] )
606620 } , ( { url } ) => url === '/evp_proxy/v2/api/v2/citestcycle' ) . then ( ( ) => done ( ) ) . catch ( done )
607621
608622 childProcess = exec (
@@ -651,7 +665,7 @@ testFrameworks.forEach(({
651665 event . content . resource === 'ci-visibility/test/ci-visibility-test.js.ci visibility can report tests'
652666 )
653667 assert . notExists ( skippedTest )
654- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
668+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
655669 const numSuites = eventTypes . reduce (
656670 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
657671 )
@@ -679,7 +693,7 @@ testFrameworks.forEach(({
679693 assert . propertyVal ( headers , 'x-datadog-evp-subdomain' , 'citestcycle-intake' )
680694 const eventTypes = payload . events . map ( event => event . type )
681695 // because they are not skipped
682- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
696+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
683697 const numSuites = eventTypes . reduce (
684698 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
685699 )
@@ -715,7 +729,7 @@ testFrameworks.forEach(({
715729 assert . propertyVal ( headers , 'x-datadog-evp-subdomain' , 'citestcycle-intake' )
716730 const eventTypes = payload . events . map ( event => event . type )
717731 // because they are not skipped
718- assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_session_end' ] )
732+ assert . includeMembers ( eventTypes , [ 'test' , 'test_suite_end' , 'test_module_end' , ' test_session_end'] )
719733 const numSuites = eventTypes . reduce (
720734 ( acc , type ) => type === 'test_suite_end' ? acc + 1 : acc , 0
721735 )
0 commit comments