Merge pull request #2617 from olvlvl/fix_browser
[mootools.git] / README.md
blobce19c4a0024b7064fb83782606eb83c5d8a253f0
1 # MooTools Core
3 [![Build Status](https://travis-ci.org/mootools/mootools-core.png?branch=master)](https://travis-ci.org/mootools/mootools-core)
5 [![Selenium Test Status](https://saucelabs.com/browser-matrix/MooTools-Core.svg)](https://saucelabs.com/u/MooTools-Core)
7 ---
9 This repository is for MooTools developers; not users.
10 All users should download MooTools from [MooTools.net](http://mootools.net/download "Download MooTools")
12 ---
13 ## Contribute
15 You are welcome to contribute to MooTools! What we ask of you:
17 a. __To report a bug:__
19    1. Crete a [jsFiddle](http://jsfiddle.net/) with the minimal amount of code to reproduce the bug.
20    2. Create a [GitHub Issue](https://github.com/mootools/mootools-core/issues), and link to the jsFiddle.
22 b. __To fix a bug:__
24    1. Clone the repo.
25    2. Add a [spec](http://jasmine.github.io/1.3/introduction.html).
26    3. Fix the bug.
27    4. Build and run the specs.
28    5. Push to your GitHub fork.
29    6. Create Pull Request, and send Pull Request.
32 __Do try to contibute!__ This is a community project.
35 ## Building & Testing
37 Current build process uses [Grunt](http://github.com/gruntjs), [Grunt MooTools Packager plugin](https://github.com/ibolmo/grunt-packager), and [Karma related repos](http://github.com/karma-runner/grunt-karma).
39 **By default**, the build process runs the tests (specs) relevant to the build. To build without testing see the `packager` build targets.
41 ### Building MooTools _With_ Compatibility
42 This means `1.4.6` that is compatible with: `1.3.x`, `1.2.x`, and so on.
44 **Examples**
46         grunt               # or
47         grunt packager:all  # to only build the source
49 ### Building MooTools _Without_ Compatibility
50 This means `1.4.6` **without** deprecated code in `1.3.x`, `1.2.x`, and so on.
52 ``` js
53 'Proceed at your own risk'
54 See the changelog or the blog related to each version for migrating your code.
55 ```
57 **Examples**
59         grunt nocompat           # or
60         grunt packager:nocompat  # to only build the source
63 ### Advanced Building and Testing
64 See the [Gruntfile](https://github.com/mootools/mootools-core/blob/1.4.6/Gruntfile.js) for further options.
66 **Examples**
68         # with compat
69         grunt --file=Function    # builds all deps on Core/Function, builds all Specs on Specs/Core/Function, runs karma
70         grunt --module=Class     # builds all deps on Class *folder*, builds all Specs on Specs/Class *folder*
72         # without compat
73         grunt nocompat --file=Function    # builds all deps on Core/Function, builds all Specs on Specs/Core/Function, runs karma
74         grunt nocompat --module=Class     # builds all deps on Class *folder*, builds all Specs on Specs/Class *folder*
76 #### Removing Other Packager Blocks
77 You'll need to add a specific task to the Gruntfile. See [line 24](https://github.com/mootools/mootools-core/blob/master/Gruntfile.js#L46) for an example.
79 ### Testing locally
81 I you want to test your local repo you need just some small steps. Follow these in order:
83     $ git clone https://github.com/mootools/mootools-core  # clone the MooTools repo
84     $ cd mootools-core                                     # get into the directory
85     $ npm install                                          # install de testing tools
86     $ npm install grunt-cli -g                             # install the Grunt command line interface
87     $ grunt default                                        # run the specs!
90 You can also change which browser to call in the Gruntfile.js.
91 __Note that__ _most browsers need to be closed when starting tests so Grunt-Karma opens and closes the browser. Otherwise they might not close on its own and fire a timeout error for inactivity._
93 Example:
95         continuous: {
96                 browsers: ['PhantomJS', 'IE', 'Chrome', 'Firefox', 'Safari']
97         },
99 If the log is too long, or if you want to store it in a file you can do:
101     $ grunt > logs.txt   # This will create a new file called logs.txt in the local directory
103 ### Testing on Travis & Sauce Labs
105 Every new Build and Pull Request is now tested on [Travis](https://travis-ci.org/) and [Sauce Labs](https://saucelabs.com/). You can also open your own free account on [Travis](https://travis-ci.org/) and [Sauce Labs](https://saucelabs.com/) to test new code ideas there.
107 [Travis](https://travis-ci.org/) testing uses [PhantomJS](http://phantomjs.org/) which is a headless browser. When connected to [Sauce Labs](https://saucelabs.com/) then it is possible to choose any number of [different Browsers and Platforms](https://saucelabs.com/platforms). You will need in this case to change the login key so it will match your account.
109 To add new Browsers in [Sauce Labs](https://saucelabs.com/) testing you can do some changes in the __[Gruntfile.js](https://github.com/mootools/mootools-core/blob/master/Gruntfile.js)__:
111  - add a new browser to the custom launchers already in the Gruntfile.
113                 customLaunchers: {
114                         chrome_linux: {
115                                 base: 'SauceLabs',
116                                 browserName: 'chrome',
117                                 platform: 'linux'
118                         },
121  - add the chosen browser to a task (max 3 browsers per task if you are using a free account):
123                 sauce2: {
124                         port: 9877,
125                         browsers: [
126                                 'safari7',
127                                 'safari6',
128                                 'safari5_osx10_6'
129                         ],
131         These tasks can be chained so its possible to test more than 3 browsers on the same test. But not more than 3 paralel.
133 __Example of a task chain:__
134 (This will run [registered tasks](http://gruntjs.com/api/grunt.task)that have been defined in the steps described before.)
136                 grunt.registerTask('default:travis', [
137                         'clean',
138                         'packager:all',
139                         'packager:specs',
140                         'karma:sauce1',
141                         'karma:sauce2',
142                         'karma:sauce3',
143                         'karma:sauce4'
144                         // 'karma:sauce5',
145                         // 'karma:sauce6'
146                 ])
148 #### Browsers, Platforms, and More
150 This test suite is ready for Travis & SauceLabs.
151 You can also run locally.
153 Support:
155  - IE
156  - Firefox
157  - Safari
158  - Chrome
159  - Opera
160  - PhantomJS (headless browser)
162 ## More Information
164 [See the MooTools Wiki for more information](http://github.com/mootools/mootools-core/wikis)