@@ -20,40 +20,44 @@ afterEach(() => {
2020 }
2121} ) ;
2222
23- test ( "WebSearch executes the configured script with the query as one argument" , async ( ) => {
24- const workspace = createTempWorkspace ( ) ;
25- const scriptPath = path . join ( workspace , "web-search.sh" ) ;
26- fs . writeFileSync (
27- scriptPath ,
28- [
29- "#!/bin/sh" ,
30- "printf 'query=%s\\n' \"$1\"" ,
31- "printf 'cwd=%s\\n' \"$PWD\"" ,
32- "printf 'webhook=%s\\n' \"$WEBHOOK\"" ,
33- ] . join ( "\n" ) ,
34- "utf8"
35- ) ;
36- fs . chmodSync ( scriptPath , 0o755 ) ;
23+ test (
24+ "WebSearch executes the configured script with the query as one argument" ,
25+ { skip : process . platform === "win32" } ,
26+ async ( ) => {
27+ const workspace = createTempWorkspace ( ) ;
28+ const scriptPath = path . join ( workspace , "web-search.sh" ) ;
29+ fs . writeFileSync (
30+ scriptPath ,
31+ [
32+ "#!/bin/sh" ,
33+ "printf 'query=%s\\n' \"$1\"" ,
34+ "printf 'cwd=%s\\n' \"$PWD\"" ,
35+ "printf 'webhook=%s\\n' \"$WEBHOOK\"" ,
36+ ] . join ( "\n" ) ,
37+ "utf8"
38+ ) ;
39+ fs . chmodSync ( scriptPath , 0o755 ) ;
3740
38- const starts : Array < { id : string | number ; command : string } > = [ ] ;
39- const exits : Array < string | number > = [ ] ;
40- const result = await handleWebSearchTool (
41- { query : "latest node release" } ,
42- createContext ( workspace , {
43- webSearchTool : scriptPath ,
44- env : { WEBHOOK : "configured" } ,
45- onProcessStart : ( id , command ) => starts . push ( { id, command } ) ,
46- onProcessExit : ( id ) => exits . push ( id ) ,
47- } )
48- ) ;
49- const realWorkspace = fs . realpathSync ( workspace ) ;
41+ const starts : Array < { id : string | number ; command : string } > = [ ] ;
42+ const exits : Array < string | number > = [ ] ;
43+ const result = await handleWebSearchTool (
44+ { query : "latest node release" } ,
45+ createContext ( workspace , {
46+ webSearchTool : scriptPath ,
47+ env : { WEBHOOK : "configured" } ,
48+ onProcessStart : ( id , command ) => starts . push ( { id, command } ) ,
49+ onProcessExit : ( id ) => exits . push ( id ) ,
50+ } )
51+ ) ;
52+ const realWorkspace = fs . realpathSync ( workspace ) ;
5053
51- assert . equal ( result . ok , true ) ;
52- assert . equal ( result . output , `query=latest node release\ncwd=${ realWorkspace } \nwebhook=configured\n` ) ;
53- assert . equal ( starts . length , 1 ) ;
54- assert . match ( starts [ 0 ] . command , / ^ W e b S e a r c h : l a t e s t n o d e r e l e a s e $ / ) ;
55- assert . deepEqual ( exits , [ starts [ 0 ] . id ] ) ;
56- } ) ;
54+ assert . equal ( result . ok , true ) ;
55+ assert . equal ( result . output , `query=latest node release\ncwd=${ realWorkspace } \nwebhook=configured\n` ) ;
56+ assert . equal ( starts . length , 1 ) ;
57+ assert . match ( starts [ 0 ] . command , / ^ W e b S e a r c h : l a t e s t n o d e r e l e a s e $ / ) ;
58+ assert . deepEqual ( exits , [ starts [ 0 ] . id ] ) ;
59+ }
60+ ) ;
5761
5862test ( "WebSearch uses the default API when no script is configured" , async ( ) => {
5963 const workspace = createTempWorkspace ( ) ;
0 commit comments