From 58fe858040a441be4e4d260f9e07e2d966796f7a Mon Sep 17 00:00:00 2001 From: soulgalore Date: Mon, 31 Jan 2022 18:41:49 +0100 Subject: [PATCH] docs: update debug scripts --- docs/documentation/sitespeed.io/scripting/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/documentation/sitespeed.io/scripting/index.md b/docs/documentation/sitespeed.io/scripting/index.md index 26656c135..a8fd55115 100644 --- a/docs/documentation/sitespeed.io/scripting/index.md +++ b/docs/documentation/sitespeed.io/scripting/index.md @@ -177,8 +177,8 @@ module.exports = { ## Debug There's a couple of way that makes it easier to debug your scripts: -* Make sure to [use the log](#log-from-your-script) so you can see what happens in your log output. -* Either run the script locally on your desktop without XVFB (using [npm version of sitespeed.io](https://www.npmjs.com/package/sitespeed.io)) so you can see in the browser window what happens. Or if you use Docker you can add --browsertime.videoParams.debug when you record the video. That way you will get one full video of all your scripts (but no Visual Metrics). +* Make sure to [use the log](#log-from-your-script) so you can see what happens in your log output. Add `context.log.info('Info logging from your script');` add your script will log in sitespeed.io default log. +* Run the script locally on your desktop without XVFB (using [npm version of sitespeed.io](https://www.npmjs.com/package/sitespeed.io)) so you can see in the browser window what happens. Or if you use Docker you can add --browsertime.videoParams.debug when you record the video. That way you will get one full video of all your scripts (but no Visual Metrics). * Use try/catch and await promises so you catch things that doesn't work. * If you use plain JavaScript you can copy/paste it and run it in your browsers console to make sure it really works. * Take a [screenshot](/documentation/sitespeed.io/scripting/#screenshot) when your script fail to make it easier to see what's going on.