@@ -231,8 +231,12 @@ describe("telemetry.event-types", () => {
231231 "warehouse_discovery" ,
232232 "warehouse_census" ,
233233 "core_failure" ,
234+ "first_launch" ,
235+ "skill_created" ,
236+ "skill_installed" ,
237+ "skill_removed" ,
234238 ]
235- expect ( eventTypes . length ) . toBe ( 33 )
239+ expect ( eventTypes . length ) . toBe ( 37 )
236240 } )
237241} )
238242
@@ -352,6 +356,10 @@ describe("telemetry.naming-convention", () => {
352356 "warehouse_discovery" ,
353357 "warehouse_census" ,
354358 "core_failure" ,
359+ "first_launch" ,
360+ "skill_created" ,
361+ "skill_installed" ,
362+ "skill_removed" ,
355363 ]
356364 for ( const t of types ) {
357365 expect ( t ) . toMatch ( / ^ [ a - z ] [ a - z 0 - 9 _ ] * $ / )
@@ -418,8 +426,7 @@ describe("telemetry.parseConnectionString (indirect)", () => {
418426
419427 try {
420428 delete process . env . ALTIMATE_TELEMETRY_DISABLED
421- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
422- "IngestionEndpoint=https://example.com"
429+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "IngestionEndpoint=https://example.com"
423430 await Telemetry . init ( )
424431
425432 Telemetry . track ( {
@@ -734,8 +741,7 @@ describe("telemetry.flush", () => {
734741
735742 try {
736743 delete process . env . ALTIMATE_TELEMETRY_DISABLED
737- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
738- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
744+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
739745 await Telemetry . init ( )
740746
741747 Telemetry . track ( {
@@ -770,8 +776,7 @@ describe("telemetry.flush", () => {
770776
771777 try {
772778 delete process . env . ALTIMATE_TELEMETRY_DISABLED
773- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
774- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
779+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
775780 await Telemetry . init ( )
776781
777782 Telemetry . track ( {
@@ -810,8 +815,7 @@ describe("telemetry.flush", () => {
810815
811816 try {
812817 delete process . env . ALTIMATE_TELEMETRY_DISABLED
813- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
814- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
818+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
815819 await Telemetry . init ( )
816820
817821 Telemetry . track ( {
@@ -858,8 +862,7 @@ describe("telemetry.flush", () => {
858862
859863 try {
860864 delete process . env . ALTIMATE_TELEMETRY_DISABLED
861- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
862- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
865+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
863866 await Telemetry . init ( )
864867
865868 Telemetry . track ( {
@@ -894,8 +897,7 @@ describe("telemetry.flush", () => {
894897
895898 try {
896899 delete process . env . ALTIMATE_TELEMETRY_DISABLED
897- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
898- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
900+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
899901 await Telemetry . init ( )
900902
901903 // Fill buffer beyond MAX_BUFFER_SIZE (200) to trigger drops
@@ -917,8 +919,8 @@ describe("telemetry.flush", () => {
917919 const envelopes = JSON . parse ( fetchBodies [ 0 ] )
918920 // Should include a TelemetryBufferOverflow error event
919921 const overflowEvent = envelopes . find (
920- ( e : any ) => e . data ?. baseData ?. name === "error" &&
921- e . data ?. baseData ?. properties ?. error_name === "TelemetryBufferOverflow" ,
922+ ( e : any ) =>
923+ e . data ?. baseData ?. name === "error" && e . data ?. baseData ?. properties ?. error_name === "TelemetryBufferOverflow" ,
922924 )
923925 expect ( overflowEvent ) . toBeDefined ( )
924926 expect ( overflowEvent . data . baseData . properties . error_message ) . toContain ( "10 events dropped" )
@@ -970,8 +972,7 @@ describe("telemetry.shutdown", () => {
970972
971973 try {
972974 delete process . env . ALTIMATE_TELEMETRY_DISABLED
973- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
974- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
975+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
975976 await Telemetry . init ( )
976977
977978 Telemetry . track ( {
@@ -1005,8 +1006,7 @@ describe("telemetry.shutdown", () => {
10051006
10061007 try {
10071008 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1008- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1009- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1009+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
10101010 await Telemetry . init ( )
10111011
10121012 Telemetry . setContext ( { sessionId : "sess-1" , projectId : "proj-1" } )
@@ -1060,8 +1060,7 @@ describe("telemetry.shutdown", () => {
10601060
10611061 try {
10621062 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1063- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1064- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1063+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
10651064 await Telemetry . init ( )
10661065 await Telemetry . shutdown ( )
10671066
@@ -1101,8 +1100,7 @@ describe("telemetry.buffer overflow", () => {
11011100
11021101 try {
11031102 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1104- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1105- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1103+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
11061104 await Telemetry . init ( )
11071105
11081106 // Track 250 events — first 50 should be dropped
@@ -1158,8 +1156,7 @@ describe("telemetry.buffer overflow", () => {
11581156
11591157 try {
11601158 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1161- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1162- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1159+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
11631160 await Telemetry . init ( )
11641161
11651162 // Exactly 205 events — 5 should be dropped
@@ -1211,8 +1208,7 @@ describe("telemetry.init with enabled telemetry", () => {
12111208
12121209 try {
12131210 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1214- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1215- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1211+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
12161212 await Telemetry . init ( )
12171213
12181214 // If flush timer is set up, tracking + waiting should eventually trigger flush
@@ -1316,8 +1312,7 @@ describe("telemetry.init with enabled telemetry", () => {
13161312
13171313 try {
13181314 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1319- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1320- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1315+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
13211316
13221317 const p1 = Telemetry . init ( )
13231318 const p2 = Telemetry . init ( )
@@ -1450,6 +1445,18 @@ describe("telemetry.memory", () => {
14501445 } )
14511446 } ) . not . toThrow ( )
14521447 } )
1448+
1449+ test ( "track accepts first_launch event without throwing" , ( ) => {
1450+ expect ( ( ) => {
1451+ Telemetry . track ( {
1452+ type : "first_launch" ,
1453+ timestamp : Date . now ( ) ,
1454+ session_id : "" ,
1455+ version : "0.5.9" ,
1456+ is_upgrade : false ,
1457+ } )
1458+ } ) . not . toThrow ( )
1459+ } )
14531460} )
14541461
14551462// ---------------------------------------------------------------------------
@@ -1483,8 +1490,7 @@ describe("Telemetry.isEnabled()", () => {
14831490 spyOn ( global , "fetch" ) . mockImplementation ( async ( ) => new Response ( "" , { status : 200 } ) )
14841491 try {
14851492 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1486- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1487- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1493+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
14881494 await Telemetry . init ( )
14891495 expect ( Telemetry . isEnabled ( ) ) . toBe ( true )
14901496 } finally {
@@ -1501,8 +1507,7 @@ describe("Telemetry.isEnabled()", () => {
15011507 spyOn ( global , "fetch" ) . mockImplementation ( async ( ) => new Response ( "" , { status : 200 } ) )
15021508 try {
15031509 delete process . env . ALTIMATE_TELEMETRY_DISABLED
1504- process . env . APPLICATIONINSIGHTS_CONNECTION_STRING =
1505- "InstrumentationKey=k;IngestionEndpoint=https://e.com"
1510+ process . env . APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=k;IngestionEndpoint=https://e.com"
15061511 await Telemetry . init ( )
15071512 expect ( Telemetry . isEnabled ( ) ) . toBe ( true )
15081513 await Telemetry . shutdown ( )
0 commit comments