Skip to content

How to debug?

Vu Bao Nhu edited this page Mar 10, 2021 · 1 revision

You may have tried BotScript and want to discover more?

Here are tips that help you understand how it actually works!

1. Configure mocha

Do steps following:

  • Turn on test you are interested in
  • Ignore other tests by comment

In the file test/mocha.opts, look like:

--require ts-node/register
--reporter spec
--delay true
--retries 0  # do not need to retries on your local machine
--exit
#test/**/*.spec.ts

## test only 1 spec name: tracuu_bn
test/e2e/delay.spec.ts
test/e2e/tracuu_bn.spec.ts

2. Enable debug on Terminal

By doing set the variable environment then you will see the debug logs:

Open termial and type:

# on windows
set DEBUG=BotScript:*

# see only info logs
set DEBUG=BotScript:INFO:*

Run npm test to see the tests passed.

3. Enable debug on Browser

To debug on the browser, you open and go to playground at: https://play.botscript.ai/

Inspect or open DevTools:

# enter this command at console tab
localStorage.debug='BotScript:INFO:*'

# see all other logs
localStorage.debug='BotScript:*'

Then refresh the web page by enter F5 to see logs in console.

4. Test what you want

You can do:

  • Run a spec test on Terminal
  • Chat with bot on browser and see the logs.
Clone this wiki locally