ubdate
This commit is contained in:
14
node_modules/console-stream/.npmignore
generated
vendored
Normal file
14
node_modules/console-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
.monitor
|
||||
.*.swp
|
||||
.nodemonignore
|
||||
releases
|
||||
*.log
|
||||
*.err
|
||||
fleet.json
|
||||
public/browserify
|
||||
bin/*.json
|
||||
.bin
|
||||
build
|
||||
compile
|
||||
.lock-wscript
|
||||
14
node_modules/console-stream/.testem.json
generated
vendored
Normal file
14
node_modules/console-stream/.testem.json
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"launchers": {
|
||||
"node": {
|
||||
"command": "npm test"
|
||||
}
|
||||
},
|
||||
"src_files": [
|
||||
"./**/*.js"
|
||||
],
|
||||
"before_tests": "npm run build",
|
||||
"on_exit": "rm test/static/bundle.js",
|
||||
"test_page": "test/static/index.html",
|
||||
"launch_in_dev": ["node", "phantomjs"]
|
||||
}
|
||||
4
node_modules/console-stream/.travis.yml
generated
vendored
Normal file
4
node_modules/console-stream/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.9
|
||||
19
node_modules/console-stream/LICENCE
generated
vendored
Normal file
19
node_modules/console-stream/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 Raynos.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
42
node_modules/console-stream/README.md
generated
vendored
Normal file
42
node_modules/console-stream/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# console-stream
|
||||
|
||||
[![build status][1]][2]
|
||||
|
||||
[![browser support][3]][4]
|
||||
|
||||
A writable stream that writes to the console
|
||||
|
||||
Refactored out of [tape][5]
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var ConsoleStream = require("console-stream")
|
||||
|
||||
var stream = ConsoleStream()
|
||||
|
||||
stream.write("one")
|
||||
stream.write("two\n")
|
||||
// console.log('onetwo')
|
||||
stream.write("three\nfour")
|
||||
// console.log('three')
|
||||
stream.end("five")
|
||||
// console.log('fourfive')
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install console-stream`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
|
||||
[1]: https://secure.travis-ci.org/Raynos/console-stream.png
|
||||
[2]: http://travis-ci.org/Raynos/console-stream
|
||||
[3]: http://ci.testling.com/Raynos/console-stream.png
|
||||
[4]: http://ci.testling.com/Raynos/console-stream
|
||||
[5]: https://github.com/substack/tape/blob/028e858f85c6916a730dca183c00469ebb869729/lib/default_stream.js
|
||||
45
node_modules/console-stream/index.js
generated
vendored
Normal file
45
node_modules/console-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var Stream = require("stream")
|
||||
var console = require("console")
|
||||
|
||||
var NEW_LINE = "\n"
|
||||
|
||||
module.exports = ConsoleStream
|
||||
|
||||
function ConsoleStream() {
|
||||
var stream = new Stream()
|
||||
stream.writable = true
|
||||
var buffered = ""
|
||||
|
||||
stream.write = write
|
||||
stream.destroy = destroy
|
||||
stream.end = end
|
||||
|
||||
return stream
|
||||
|
||||
function write(buffer) {
|
||||
var s = buffered + String(buffer)
|
||||
var lines = s.split(NEW_LINE)
|
||||
for (var i = 0; i < lines.length - 1; i++) {
|
||||
console.log(lines[i])
|
||||
}
|
||||
|
||||
buffered = lines[i]
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
stream.writable = false
|
||||
stream.emit("close")
|
||||
}
|
||||
|
||||
function end(buffer) {
|
||||
if (arguments.length === 1) {
|
||||
stream.write(buffer)
|
||||
}
|
||||
|
||||
if (buffered) {
|
||||
console.log(buffered)
|
||||
}
|
||||
|
||||
stream.destroy()
|
||||
}
|
||||
}
|
||||
63
node_modules/console-stream/package.json
generated
vendored
Normal file
63
node_modules/console-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "console-stream",
|
||||
"version": "0.1.1",
|
||||
"description": "A writable stream that writes to the console",
|
||||
"keywords": [],
|
||||
"author": "Raynos <raynos2@gmail.com>",
|
||||
"repository": "git://github.com/Raynos/console-stream.git",
|
||||
"main": "index",
|
||||
"homepage": "https://github.com/Raynos/console-stream",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Raynos"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/console-stream/issues",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "~0.2.2",
|
||||
"browserify": "https://github.com/raynos/node-browserify/tarball/master",
|
||||
"testem": "~0.2.55"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/Raynos/console-stream/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node ./test",
|
||||
"build": "browserify test/index.js -o test/static/bundle.js",
|
||||
"testem": "testem"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": {
|
||||
"ie": [
|
||||
"8",
|
||||
"9",
|
||||
"10"
|
||||
],
|
||||
"firefox": [
|
||||
"16",
|
||||
"17",
|
||||
"nightly"
|
||||
],
|
||||
"chrome": [
|
||||
"22",
|
||||
"23",
|
||||
"canary"
|
||||
],
|
||||
"opera": [
|
||||
"12",
|
||||
"next"
|
||||
],
|
||||
"safari": [
|
||||
"5.1"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
83
node_modules/console-stream/test/index.js
generated
vendored
Normal file
83
node_modules/console-stream/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
var ConsoleStream = require("../index")
|
||||
var console = require("console")
|
||||
var test = require("tape")
|
||||
|
||||
test("console stream", function (assert) {
|
||||
var stream = ConsoleStream()
|
||||
|
||||
assert.ok(stream.write)
|
||||
assert.ok(stream.end)
|
||||
assert.ok(stream.destroy)
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("console stream destroy", function (assert) {
|
||||
var stream = ConsoleStream()
|
||||
|
||||
stream.once("close", function () {
|
||||
assert.ok(true)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
stream.destroy()
|
||||
})
|
||||
|
||||
test("console stream end", function (assert) {
|
||||
var old = console.log
|
||||
console.log = intercept
|
||||
|
||||
var closed = false
|
||||
var stream = ConsoleStream()
|
||||
var list = []
|
||||
|
||||
stream.once("close", function () {
|
||||
closed = true
|
||||
|
||||
console.log = old
|
||||
|
||||
assert.deepEqual(list, ["foo"])
|
||||
assert.equal(closed, true)
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
stream.end("foo")
|
||||
|
||||
function intercept(chunk) {
|
||||
list.push(chunk)
|
||||
|
||||
// old.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
|
||||
test("console stream write", function (assert) {
|
||||
var old = console.log
|
||||
console.log = intercept
|
||||
|
||||
var list = []
|
||||
var stream = ConsoleStream()
|
||||
|
||||
stream.write("one")
|
||||
stream.write("two")
|
||||
stream.write("three")
|
||||
stream.write("four\n")
|
||||
stream.write("five\na")
|
||||
stream.write("bar")
|
||||
stream.end()
|
||||
|
||||
console.log = old
|
||||
|
||||
assert.deepEqual(list, [
|
||||
"onetwothreefour"
|
||||
, "five"
|
||||
, "abar"
|
||||
])
|
||||
assert.end()
|
||||
|
||||
function intercept(chunk) {
|
||||
list.push(chunk)
|
||||
|
||||
// old.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
11
node_modules/console-stream/test/static/index.html
generated
vendored
Normal file
11
node_modules/console-stream/test/static/index.html
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>TAPE Example</title>
|
||||
<script src="/testem.js"></script>
|
||||
<script src="test-adapter.js"></script>
|
||||
<script src="bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
53
node_modules/console-stream/test/static/test-adapter.js
generated
vendored
Normal file
53
node_modules/console-stream/test/static/test-adapter.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
(function () {
|
||||
var Testem = window.Testem
|
||||
var regex = /^((?:not )?ok) (\d+) (.+)$/
|
||||
|
||||
Testem.useCustomAdapter(tapAdapter)
|
||||
|
||||
function tapAdapter(socket){
|
||||
var results = {
|
||||
failed: 0
|
||||
, passed: 0
|
||||
, total: 0
|
||||
, tests: []
|
||||
}
|
||||
|
||||
socket.emit('tests-start')
|
||||
|
||||
Testem.handleConsoleMessage = function(msg){
|
||||
var m = msg.match(regex)
|
||||
if (m) {
|
||||
var passed = m[1] === 'ok'
|
||||
var test = {
|
||||
passed: passed ? 1 : 0,
|
||||
failed: passed ? 0 : 1,
|
||||
total: 1,
|
||||
id: m[2],
|
||||
name: m[3],
|
||||
items: []
|
||||
}
|
||||
|
||||
if (passed) {
|
||||
results.passed++
|
||||
} else {
|
||||
console.error("failure", m)
|
||||
|
||||
results.failed++
|
||||
}
|
||||
|
||||
results.total++
|
||||
|
||||
// console.log("emitted test", test)
|
||||
socket.emit('test-result', test)
|
||||
results.tests.push(test)
|
||||
} else if (msg === '# ok' || msg.match(/^# tests \d+/)){
|
||||
// console.log("emitted all test")
|
||||
socket.emit('all-test-results', results)
|
||||
}
|
||||
|
||||
// return false if you want to prevent the console message from
|
||||
// going to the console
|
||||
// return false
|
||||
}
|
||||
}
|
||||
}())
|
||||
Reference in New Issue
Block a user