Choice Script Changes To Run Tests With Firefox ver 68 ( See Post 12 & 31)

I’ve just built out a new, more convenient way to test ChoiceScript, saving you from having to click the “Upload” button every time you test.

First, you’ll need to install Node.js and you’ll need the latest version of ChoiceScript from Github.

Next, you’ll need to open your “Command Prompt” (on Windows) or “Terminal” (on macOS), and cd to the directory containing ChoiceScript.

There, you can run these commands:

  • node serve: Creates a basic localhost web server on a random port number and launches your ChoiceScript game there. You can refresh your browser to test your updated code, just like you used to in the good old days. (Note that if the command prompt/terminal window closes, the server will stop, and your browser tab will stop working.)

    • While you’re running node serve, you can replace web/mygame/index.html with quicktest.html to run QuickTest. Refresh the browser to re-run quicktest.html.
    • You can instead replace web/mygame/index.html with randomtest.html to run RandomTest. Refresh the browser to re-run randomtest.html.
  • node quicktest: Run QuickTest in your command prompt or terminal. You may find that node quicktest runs more quickly than quicktest.html.

  • node randomtest num=10: Run RandomTest in your command prompt or terminal. Change the num to any number you like.

    There are other randomtest options available, like this:

    node randomtest num=10 seed=4
    node randomtest avoidUsedOptions=false showChoices=false
    node randomtest showText=false showCoverage=false
    

    These options work exactly like the checkboxes in randomtest.html.

You don’t have to install Node to test ChoiceScript or do any of the stuff described here; using Node just saves you from having to click on the Upload button each time you test.

7 Likes