-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for buster test in browsers
- Loading branch information
Krzysztof Chrapka
committed
Apr 24, 2016
1 parent
b123f54
commit a0cd7a2
Showing
64 changed files
with
431 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
experiments/ | ||
.idea/ | ||
*~ | ||
*.log | ||
bower_components/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Testing wire.js | ||
|
||
Wire.js is using [buster](http://busterjs.org) for testing. You need to have [node.js](https://nodejs.org) installed to run tests of wire.js. | ||
|
||
# Testing in node.js: | ||
|
||
[Install wire.js](docs/get.md) and run in installation directory | ||
$ npm install | ||
$ npm test | ||
|
||
# Testing in browser | ||
|
||
[Install wire.js](docs/get.md) and run in installation directory | ||
|
||
``` | ||
$ npm install | ||
$ npm run-script start-test-server | ||
``` | ||
|
||
Open http://localhost:1111 in your browser and click "Capture browser" button. Browser is now connected to test server | ||
and will be used by it to run tests. | ||
|
||
Run in wire.js installation directory (without closing browser and test server) | ||
``` | ||
$ npm run-script browser-test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,62 @@ | ||
{ | ||
"name": "wire", | ||
"version": "0.10.11", | ||
"description": "A light, fast, flexible Javascript IOC container.", | ||
"keywords": [ | ||
"ioc", | ||
"aop", | ||
"dependency injection", | ||
"dependency inversion", | ||
"application composition", | ||
"cujo" | ||
], | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cujojs/wire" | ||
}, | ||
"bugs": "https://github.com/cujojs/wire/issues", | ||
"maintainers": [ | ||
{ | ||
"name": "Brian Cavalier", | ||
"web": "http://hovercraftstudios.com" | ||
} | ||
], | ||
"contributors": [ | ||
{ | ||
"name": "Brian Cavalier", | ||
"web": "http://hovercraftstudios.com" | ||
}, | ||
{ | ||
"name": "John Hann", | ||
"web": "http://unscriptable.com" | ||
} | ||
], | ||
"dependencies": { | ||
"meld": "~1", | ||
"when": ">=2.6.0 <4" | ||
}, | ||
"devDependencies": { | ||
"buster": "~0.7", | ||
"bower": "~1", | ||
"gent": "~0.6" | ||
}, | ||
"main": "./wire", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "buster-test -e node", | ||
"prepublish": "bower install" | ||
} | ||
"name": "wire", | ||
"version": "0.10.11", | ||
"description": "A light, fast, flexible Javascript IOC container.", | ||
"keywords": [ | ||
"ioc", | ||
"aop", | ||
"dependency injection", | ||
"dependency inversion", | ||
"application composition", | ||
"cujo" | ||
], | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cujojs/wire" | ||
}, | ||
"bugs": "https://github.com/cujojs/wire/issues", | ||
"maintainers": [ | ||
{ | ||
"name": "Brian Cavalier", | ||
"web": "http://hovercraftstudios.com" | ||
} | ||
], | ||
"contributors": [ | ||
{ | ||
"name": "Brian Cavalier", | ||
"web": "http://hovercraftstudios.com" | ||
}, | ||
{ | ||
"name": "John Hann", | ||
"web": "http://unscriptable.com" | ||
} | ||
], | ||
"dependencies": { | ||
"meld": "~1", | ||
"when": ">=2.6.0 <4" | ||
}, | ||
"devDependencies": { | ||
"bower": "~1", | ||
"buster": "~0.7", | ||
"buster-amd": "^0.3.1", | ||
"gent": "~0.6", | ||
"glob": "^7.0.3", | ||
"requirejs": "^2.2.0" | ||
}, | ||
"main": "./wire", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "buster-test -e node", | ||
"start-test-server": "buster-server", | ||
"browser-test": "buster-test -e browser", | ||
"prepublish": "bower install" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
var templ = '(function(define){\n'+ | ||
'\n'+ | ||
' function evaluates (statement) {\n'+ | ||
' try {\n'+ | ||
' eval(statement);\n'+ | ||
' return true;\n'+ | ||
' } catch (err) {\n'+ | ||
' return false;\n'+ | ||
' }\n'+ | ||
' }\n'+ | ||
'\n'+ | ||
' function isClassAvailable() {\n'+ | ||
' return evaluates(\'class es6TestClass_ibyechBaloodren7 {}\');\n'+ | ||
' }\n'+ | ||
'\n'+ | ||
' function isSpreadAvailable() {\n'+ | ||
' return evaluates(\'parseInt(...[\"20\", 10])\');\n'+ | ||
' }\n'+ | ||
'\n'+ | ||
' var tests = TEST_FILES;\n'+ | ||
' var requires = [];\n'+ | ||
'\n'+ | ||
' if(\n'+ | ||
' isClassAvailable()\n'+ | ||
' && isSpreadAvailable()\n'+ | ||
' && !(typeof(process) !== \'undefined\' && \'ES_VERSION\' in process.env && parseFloat(process.env.ES_VERSION) < 6)\n'+ | ||
' ) {\n'+ | ||
' requires = tests;\n'+ | ||
' }\n'+ | ||
' console.log(\'class operator \'+ (isClassAvailable() ? \'\' : \'not \') + \'available in browser\');\n'+ | ||
' console.log(\'spread operator \'+ (isSpreadAvailable() ? \'\' : \'not \') + \'available in browser\');\n'+ | ||
' define(requires, function(){});\n'+ | ||
'\n'+ | ||
'})(typeof define !== \'undefined\' ? define : function(factory){module.exports = factory(require);});'; | ||
|
||
module.exports = function (testFiles){ | ||
return templ.replace(/TEST_FILES/, JSON.stringify(testFiles)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function(define){ | ||
|
||
function evaluates (statement) { | ||
try { | ||
eval(statement); | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
function isClassAvailable() { | ||
return evaluates('class es6TestClass_ibyechBaloodren7 {}'); | ||
} | ||
|
||
function isSpreadAvailable() { | ||
return evaluates('parseInt(...["20", 10])'); | ||
} | ||
|
||
var tests = []; | ||
var requires = []; | ||
|
||
if( | ||
isClassAvailable() | ||
&& isSpreadAvailable() | ||
&& !(typeof(process) !== 'undefined' && 'ES_VERSION' in process.env && parseFloat(process.env.ES_VERSION) < 6) | ||
) { | ||
requires = tests; | ||
} | ||
console.log('class operator '+ (isClassAvailable() ? '' : 'not ') + 'available in browser'); | ||
console.log('spread operator '+ (isSpreadAvailable() ? '' : 'not ') + 'available in browser'); | ||
define(requires, function(){}); | ||
|
||
})(typeof define !== 'undefined' ? define : function(factory){module.exports = factory(require);}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.