From 49d678e9a2c5dd848f5e7fcc26e737594296fb4c Mon Sep 17 00:00:00 2001 From: 1111hui <26634873@qq.com> Date: Mon, 10 Oct 2016 16:41:57 +0800 Subject: [PATCH 1/2] double test timeout for test pass in old machine --- api/tests/test-router.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/tests/test-router.js b/api/tests/test-router.js index 39d5d61f..721d6b28 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -294,7 +294,7 @@ o.spec("route", function() { }) 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 Component = { @@ -546,17 +546,17 @@ o.spec("route", function() { o(route.get()).equals("/") - + route.set("/2") setTimeout(function(){ o(route.get()).equals("/") - done() + done() }, FRAME_BUDGET) }) - + o("routing with RouteResolver works more than once", function(done, timeout) { - timeout(100) + timeout(200) $window.location.href = prefix + "/a" route(root, '/a', { @@ -584,9 +584,9 @@ o.spec("route", function() { }, FRAME_BUDGET) }, FRAME_BUDGET) }) - + o("calling route.set invalidates pending onmatch resolution", function(done, timeout) { - timeout(100) + timeout(200) var resolved $window.location.href = prefix + "/a" From d02a238bf0d513887cf455cd60b3ae32d3d0ced7 Mon Sep 17 00:00:00 2001 From: Douglas Brown Date: Fri, 14 Oct 2016 13:27:44 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=81=20=20Adjust=20ospec=20bin=20de?= =?UTF-8?q?f,=20add=20to=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Getting set up with ospec is deceptively simple, and adding just a bit more documentation should help new users from falling into the trap of overthinking the test config. (I know that I ended up down a very strange rabbit hole when pulling ospec into a project). This also adjusts the bin definition in the package file so that we can hopefully just use the `ospec` command instead of a folder ref. --- ospec/README.md | 38 +++++++++++++++++++++++++++++++++++++- ospec/package.json | 4 +++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ospec/README.md b/ospec/README.md index 8b160277..143f67f8 100644 --- a/ospec/README.md +++ b/ospec/README.md @@ -4,7 +4,7 @@ Noiseless testing framework -Version: 1.1 +Version: 1.1 License: MIT ## About @@ -259,6 +259,42 @@ _o("a test", function() { _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 diff --git a/ospec/package.json b/ospec/package.json index 1143482c..0dd9df2b 100644 --- a/ospec/package.json +++ b/ospec/package.json @@ -9,6 +9,8 @@ "keywords": [ "testing" ], "author": "Leo Horie ", "license": "MIT", - "bin": "./bin/ospec", + "bin": { + "ospec": "./bin/ospec" + }, "repository": "lhorie/mithril.js#rewrite" }