Casperjs "casper.test property is only available using the `casperjs test` command" but not calling casper test

casperjs, phantomjs

Solution

You can add

phantom.casperTest = true;

at the top of the test file.

Problem

The error: ``` casper.test property is only available using the `casperjs test` command ``` Searched my entire codebase for "casper.test", "this.test", "@test", etc, and none are present. Looking at the casper code, one of these needs to be triggered for this error to be raised. The error is intermittent and only occurs on some casper runs. Has anyone else gotten this bug? I'm running `1.1.0-beta3`.

Original source