File tree Expand file tree Collapse file tree 7 files changed +26
-12
lines changed Expand file tree Collapse file tree 7 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export const chunk: LifecycleExecutor = async (
81
81
82
82
await callbacks . onResult ( pack , result ) ;
83
83
logger . debug (
84
- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
84
+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
85
85
) ;
86
86
} else {
87
87
logger . debug (
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export const post: LifecycleExecutor = async (
51
51
52
52
await callbacks . onResult ( pack , result ) ;
53
53
logger . debug (
54
- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
54
+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
55
55
) ;
56
56
} else {
57
57
logger . debug (
Original file line number Diff line number Diff line change @@ -41,14 +41,17 @@ export const pre: LifecycleExecutor = async (
41
41
42
42
if ( output ) {
43
43
const result = output ?. json ( ) as PluginOutput ;
44
+ logger . debug (
45
+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } DATA: ${ JSON . stringify ( result ) } `
46
+ ) ;
44
47
45
48
if ( result . context ) {
46
49
context [ `${ index } ` ] = result . context ;
47
50
}
48
51
49
52
await callbacks . onResult ( pack , result ) ;
50
53
logger . debug (
51
- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
54
+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
52
55
) ;
53
56
} else {
54
57
logger . debug (
Original file line number Diff line number Diff line change @@ -41,9 +41,11 @@ export const run = async (
41
41
logger . debug ( `[${ requestId } ] making request` ) ;
42
42
const finalizedRequest = request . clone ( ) ;
43
43
finalizedRequest . headers . set ( "x-tskl-bypass" , "1" ) ;
44
- const rawResponse = await fetch ( finalizedRequest ) ;
45
44
await pre ;
46
45
46
+ // resolve the pre hooks as late as possible
47
+ const [ rawResponse ] = await Promise . all ( [ fetch ( finalizedRequest ) , pre ] ) ;
48
+
47
49
// GZIP headers are being handled by undici and must be stripped
48
50
const newHeaders : Array < [ string , string ] > = [ ...rawResponse . headers . entries ( ) ]
49
51
. map ( ( [ key , value ] ) => {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ describe("Loading packs", () => {
60
60
} ) ;
61
61
62
62
const t = taskless ( "test" , {
63
- // logLevel: "debug",
63
+ logLevel : "debug" ,
64
64
logging : true ,
65
65
log : {
66
66
data : logData ,
@@ -113,18 +113,18 @@ describe("Loading packs", () => {
113
113
await t . flush ( ) ;
114
114
115
115
const log = logs [ 0 ] ;
116
- // console.log(JSON.stringify(logs, null, 2));
116
+ console . log ( JSON . stringify ( logs , null , 2 ) ) ;
117
117
118
118
expect (
119
119
log . dimensions . some (
120
- ( d ) => d . name === "testpack/testPre" && d . value === "preTest "
120
+ ( d ) => d . name === "testpack/testPre" && d . value === "test_pre_value "
121
121
) ,
122
122
"Logs pre test capture"
123
123
) . toBe ( true ) ;
124
124
125
125
expect (
126
126
log . dimensions . some (
127
- ( d ) => d . name === "testpack/testPost" && d . value === "postTest "
127
+ ( d ) => d . name === "testpack/testPost" && d . value === "test_post_value "
128
128
) ,
129
129
"Logs post test capture"
130
130
) . toBe ( true ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"schema" : " pre2" ,
3
3
"name" : " testpack" ,
4
- "version" : " 0.0.1" ,
5
- "description" : " Test pack, never published to prod" ,
6
- "permissions" : {},
7
- "fields" : [],
4
+ "version" : " 0.0.4" ,
5
+ "description" : " Test / example pack, never published to prod" ,
6
+ "permissions" : {
7
+ "body" : true
8
+ },
9
+ "fields" : [
10
+ {
11
+ "name" : " testField" ,
12
+ "type" : " string" ,
13
+ "description" : " Test field that should exist in the lifecycle" ,
14
+ "default" : " test_field_value"
15
+ }
16
+ ],
8
17
"charts" : []
9
18
}
You can’t perform that action at this time.
0 commit comments