Merge remote-tracking branch 'origin/rewrite' into rewrite

This commit is contained in:
Leo Horie 2016-10-18 18:07:28 -04:00
commit c1cb1fe3da
3 changed files with 47 additions and 9 deletions

View file

@ -294,7 +294,7 @@ o.spec("route", function() {
}) })
o("changing `vnode.key` in `render` resets the component", function(done, timeout){ o("changing `vnode.key` in `render` resets the component", function(done, timeout){
timeout(FRAME_BUDGET * 3) timeout(FRAME_BUDGET * 6)
var oninit = o.spy() var oninit = o.spy()
var Component = { var Component = {
@ -556,7 +556,7 @@ o.spec("route", function() {
}) })
o("routing with RouteResolver works more than once", function(done, timeout) { o("routing with RouteResolver works more than once", function(done, timeout) {
timeout(100) timeout(200)
$window.location.href = prefix + "/a" $window.location.href = prefix + "/a"
route(root, '/a', { route(root, '/a', {
@ -586,7 +586,7 @@ o.spec("route", function() {
}) })
o("calling route.set invalidates pending onmatch resolution", function(done, timeout) { o("calling route.set invalidates pending onmatch resolution", function(done, timeout) {
timeout(100) timeout(200)
var resolved var resolved
$window.location.href = prefix + "/a" $window.location.href = prefix + "/a"

View file

@ -259,6 +259,42 @@ _o("a test", function() {
_o.run() _o.run()
``` ```
### Running the test suite from the command-line
ospec will automatically evaluate all `*.js` files in any folder named `/tests`.
`o.run()` is automatically called by the cli - no need to call it in your test code.
#### Create an npm script in your package:
```
"scripts": {
...
"test": "ospec",
...
}
```
```
$ npm test
```
#### (Optionally) Install Globally
```
$ npm i -g ospec
$ ospec
```
#### (Optionally) Evaluate ES6+ code:
One way to accomplish this would be to include the 'babel-cli' module (`npm i babel-cli`)
(This would pre-suppose that you're already using babel in your project and thus have it configured to your liking).
```
$ babel-node ospec
```
--- ---
## API ## API

View file

@ -9,6 +9,8 @@
"keywords": [ "testing" ], "keywords": [ "testing" ],
"author": "Leo Horie <lhorie@hotmail.com>", "author": "Leo Horie <lhorie@hotmail.com>",
"license": "MIT", "license": "MIT",
"bin": "./bin/ospec", "bin": {
"ospec": "./bin/ospec"
},
"repository": "lhorie/mithril.js#rewrite" "repository": "lhorie/mithril.js#rewrite"
} }