File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,47 @@ describe.each([{ cmd: "wrangler dev" }])(
485485
486486 expect ( text ) . toBe ( "py hello world 5" ) ;
487487 } ) ;
488+
489+ it ( `can print during ${ cmd } ` , async ( ) => {
490+ const helper = new WranglerE2ETestHelper ( ) ;
491+ await helper . seed ( {
492+ "wrangler.toml" : dedent `
493+ name = "${ workerName } "
494+ main = "index.py"
495+ compatibility_date = "2023-01-01"
496+ compatibility_flags = ["python_workers"]
497+ ` ,
498+ "arithmetic.py" : dedent `
499+ def mul(a,b):
500+ return a*b` ,
501+ "index.py" : dedent `
502+ from arithmetic import mul
503+
504+ from js import Response, console
505+ def on_fetch(request):
506+ console.log(f"hello {mul(2,3)}")
507+ # TODO: Test print too once it's fixed.
508+ console.log(f"end")
509+ return Response.new(f"py hello world {mul(2,3)}")` ,
510+ "package.json" : dedent `
511+ {
512+ "name": "worker",
513+ "version": "0.0.0",
514+ "private": true
515+ }
516+ ` ,
517+ } ) ;
518+ const worker = helper . runLongLived ( cmd ) ;
519+
520+ const { url } = await worker . waitForReady ( ) ;
521+
522+ await expect ( fetchText ( url ) ) . resolves . toBe ( "py hello world 6" ) ;
523+
524+ await worker . readUntil ( / e n d / ) ;
525+
526+ const allOutput = await worker . output ;
527+ expect ( allOutput ) . contain ( "hello 6\nend" ) ;
528+ } ) ;
488529 }
489530) ;
490531
You can’t perform that action at this time.
0 commit comments