Commit c8971d57 c8971d57d7664ab690936a35607ec092d3b49845 by Mickaël Andrieu

REFS #665 - Added a backward compatibility for "--direct" option

1 parent 9b5f9255
......@@ -91,11 +91,16 @@ Execution results:
The `casperjs` command has three available options:
- ``--verbose``: to prints out log messages to the console
- ``--direct``: to prints out log messages to the console
- ``--log-level=[debug|info|warning|error]`` to set the :ref:`logging level <logging>`
- ``--engine=[phantomjs|slimerjs]`` to select the browser engine you want to use. CasperJS
supports PhantomJS (default) that runs Webkit, and SlimerJS that runs Gecko.
.. warning::
.. deprecated:: 1.1
``--direct`` option now become ``--verbose``
Example:
.. code-block:: text
......
......@@ -157,7 +157,7 @@ Options
Options are prefixed with a double-dash (``--``):
- ``--xunit=<filename>`` will export test suite results in a :ref:`XUnit XML file <xunit_report>`
- ``--verbose`` will print :doc:`log messages <logging>` directly to the console
- ``--direct`` will print :doc:`log messages <logging>` directly to the console
- ``--log-level=<logLevel>`` sets the logging level (see the :doc:`related section <logging>`)
.. versionadded:: 1.0
......@@ -176,11 +176,16 @@ Sample custom command:
$ casperjs test --includes=foo.js,bar.js \
--pre=pre-test.js \
--post=post-test.js \
--verbose \
--direct \
--log-level=debug \
--fail-fast \
test1.js test2.js /path/to/some/test/dir
.. warning::
.. deprecated:: 1.1
``--direct`` option now become ``--verbose``
.. hint::
A `demo gist <https://gist.github.com/3813361>`_ is also available in order to get you started with a sample suite involving some of these options.
......
......@@ -129,7 +129,7 @@ var Casper = function Casper(options) {
// factories
this.cli = phantom.casperArgs;
this.options.logLevel = this.cli.get('log-level', this.options.logLevel);
this.options.verbose = this.cli.has('verbose');
this.options.verbose = this.cli.has('direct') || this.cli.has('verbose');
this.colorizer = this.getColorizer();
this.mouse = mouse.create(this);
this.popups = pagestack.create();
......@@ -208,6 +208,11 @@ var Casper = function Casper(options) {
// dispatching an event when instance has been constructed
this.emit('init');
// deprecated direct option
if (this.cli.has('direct')) {
this.emit("deprecated", "--direct option has been deprecated since 1.1; you should use --verbose instead.")
}
};
// Casper class is an EventEmitter
......