@@ -453,7 +453,7 @@ function patchTargetMatchCode(code: string, targetUrl: string): string {
453453 const url = new URL ( targetUrl ) ;
454454 const targetPattern = `${ url . protocol } //${ url . hostname } /*${ url . search } ` ;
455455 return code . replace (
456- / ^ \/ \/ \s * @ m a t c h \s + .* \? ( g m _ a p i _ s y n c | g m _ a p i _ a s y n c | i n j e c t _ c o n t e n t | e a r l y _ i n j e c t _ c o n t e n t | e a r l y _ i n j e c t _ p a g e | W I N D O W _ M E S S A G E _ T E S T _ S C | S A N D B O X _ T E S T _ S C | u n w r a p _ e 2 e _ t e s t | G M _ X H R _ R E D I R E C T _ T E S T _ S C | G M _ D O W N L O A D _ T E S T _ S C | G M _ X H R _ T E S T _ S C ) $ / gm,
456+ / ^ \/ \/ \s * @ m a t c h \s + .* \? ( g m _ a p i _ s y n c | g m _ a p i _ a s y n c | i n j e c t _ c o n t e n t | e a r l y _ i n j e c t _ c o n t e n t | e a r l y _ i n j e c t _ p a g e | W I N D O W _ M E S S A G E _ T E S T _ S C | S A N D B O X _ T E S T _ S C | u n w r a p _ e 2 e _ t e s t | G M _ X H R _ R E D I R E C T _ T E S T _ S C | G M _ X H R _ T E S T _ S C ) $ / gm,
457457 `// @match ${ targetPattern } `
458458 ) ;
459459}
@@ -479,7 +479,7 @@ function patchGMApiTestCode(code: string, mockOrigin: string): string {
479479 . replace ( / h t t p s : \/ \/ w w w \. t a m p e r m o n k e y \. n e t \/ f a v i c o n \. i c o / g, `${ mockOrigin } /favicon.ico` )
480480 . replace ( / a p i \. g i t h u b \. c o m \/ r e p o s \/ s c r i p t s c a t \/ s c r i p t c a t / g, `${ mockHost } /repos/scriptscat/scriptcat` )
481481 . replace ( / h t t p b i n g o \. o r g \/ g e t / g, `${ mockHost } /get` )
482- // gm_xhr_redirect_test.js / gm_download_test.js / gm_xhr_test.js build every request URL off
482+ // gm_xhr_redirect_test.js / gm_xhr_test.js build every request URL off
483483 // this constant rather than writing literal https://httpbingo.org/... URLs.
484484 . replace ( / c o n s t H B = " h t t p s : \/ \/ h t t p b i n g o \. o r g " ; / , `const HB = "${ mockOrigin } ";` )
485485 // gm_xhr_test.js 拉三个固定的 raw.githubusercontent.com 文件,按文件名映射到本地 /raw/<file>。
@@ -860,29 +860,6 @@ test.describe("GM API", () => {
860860 expect ( passed , "No test results found - script may not have run" ) . toBeGreaterThan ( 0 ) ;
861861 } ) ;
862862
863- test ( "GM_download tests (gm_download_test.js)" , async ( { context, extensionId } ) => {
864- const { passed, failed, logs } = await runTestScript (
865- context ,
866- extensionId ,
867- "gm_download_test.js" ,
868- `${ gmApiMockServer . origin } /?GM_DOWNLOAD_TEST_SC` ,
869- 120_000 ,
870- {
871- patchCode,
872- requireOrigin : gmApiMockServer . origin ,
873- // 两个 suite 都是 auto:false;统一入口会执行自动用例,itManual 仍保持待人工确认。
874- beforeCollect : clickSuiteRunButton ( "GM_download 自动套件" ) ,
875- }
876- ) ;
877-
878- console . log ( `[gm_download_test] passed=${ passed } , failed=${ failed } ` ) ;
879- if ( failed !== 0 ) {
880- console . log ( "[gm_download_test] logs:" , logs . join ( "\n" ) ) ;
881- }
882- expect ( failed , "Some GM_download tests failed" ) . toBe ( 0 ) ;
883- expect ( passed , "No test results found - script may not have run" ) . toBeGreaterThan ( 0 ) ;
884- } ) ;
885-
886863 test ( "GM_xhr tests (gm_xhr_test.js)" , async ( { context, extensionId } ) => {
887864 const { passed, failed, logs } = await runTestScript (
888865 context ,
0 commit comments