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: ...@@ -91,11 +91,16 @@ Execution results:
91 91
92 The `casperjs` command has three available options: 92 The `casperjs` command has three available options:
93 93
94 - ``--verbose``: to prints out log messages to the console 94 - ``--direct``: to prints out log messages to the console
95 - ``--log-level=[debug|info|warning|error]`` to set the :ref:`logging level <logging>` 95 - ``--log-level=[debug|info|warning|error]`` to set the :ref:`logging level <logging>`
96 - ``--engine=[phantomjs|slimerjs]`` to select the browser engine you want to use. CasperJS 96 - ``--engine=[phantomjs|slimerjs]`` to select the browser engine you want to use. CasperJS
97 supports PhantomJS (default) that runs Webkit, and SlimerJS that runs Gecko. 97 supports PhantomJS (default) that runs Webkit, and SlimerJS that runs Gecko.
98 98
99 .. warning::
100
101 .. deprecated:: 1.1
102 ``--direct`` option now become ``--verbose``
103
99 Example: 104 Example:
100 105
101 .. code-block:: text 106 .. code-block:: text
......
...@@ -157,7 +157,7 @@ Options ...@@ -157,7 +157,7 @@ Options
157 Options are prefixed with a double-dash (``--``): 157 Options are prefixed with a double-dash (``--``):
158 158
159 - ``--xunit=<filename>`` will export test suite results in a :ref:`XUnit XML file <xunit_report>` 159 - ``--xunit=<filename>`` will export test suite results in a :ref:`XUnit XML file <xunit_report>`
160 - ``--verbose`` will print :doc:`log messages <logging>` directly to the console 160 - ``--direct`` will print :doc:`log messages <logging>` directly to the console
161 - ``--log-level=<logLevel>`` sets the logging level (see the :doc:`related section <logging>`) 161 - ``--log-level=<logLevel>`` sets the logging level (see the :doc:`related section <logging>`)
162 162
163 .. versionadded:: 1.0 163 .. versionadded:: 1.0
...@@ -176,11 +176,16 @@ Sample custom command: ...@@ -176,11 +176,16 @@ Sample custom command:
176 $ casperjs test --includes=foo.js,bar.js \ 176 $ casperjs test --includes=foo.js,bar.js \
177 --pre=pre-test.js \ 177 --pre=pre-test.js \
178 --post=post-test.js \ 178 --post=post-test.js \
179 --verbose \ 179 --direct \
180 --log-level=debug \ 180 --log-level=debug \
181 --fail-fast \ 181 --fail-fast \
182 test1.js test2.js /path/to/some/test/dir 182 test1.js test2.js /path/to/some/test/dir
183 183
184 .. warning::
185
186 .. deprecated:: 1.1
187 ``--direct`` option now become ``--verbose``
188
184 .. hint:: 189 .. hint::
185 190
186 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. 191 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) { ...@@ -129,7 +129,7 @@ var Casper = function Casper(options) {
129 // factories 129 // factories
130 this.cli = phantom.casperArgs; 130 this.cli = phantom.casperArgs;
131 this.options.logLevel = this.cli.get('log-level', this.options.logLevel); 131 this.options.logLevel = this.cli.get('log-level', this.options.logLevel);
132 this.options.verbose = this.cli.has('verbose'); 132 this.options.verbose = this.cli.has('direct') || this.cli.has('verbose');
133 this.colorizer = this.getColorizer(); 133 this.colorizer = this.getColorizer();
134 this.mouse = mouse.create(this); 134 this.mouse = mouse.create(this);
135 this.popups = pagestack.create(); 135 this.popups = pagestack.create();
...@@ -208,6 +208,11 @@ var Casper = function Casper(options) { ...@@ -208,6 +208,11 @@ var Casper = function Casper(options) {
208 208
209 // dispatching an event when instance has been constructed 209 // dispatching an event when instance has been constructed
210 this.emit('init'); 210 this.emit('init');
211
212 // deprecated direct option
213 if (this.cli.has('direct')) {
214 this.emit("deprecated", "--direct option has been deprecated since 1.1; you should use --verbose instead.")
215 }
211 }; 216 };
212 217
213 // Casper class is an EventEmitter 218 // Casper class is an EventEmitter
......