diff options
Diffstat (limited to 'node_modules/console-browserify')
| -rw-r--r-- | node_modules/console-browserify/.npmignore | 14 | ||||
| -rw-r--r-- | node_modules/console-browserify/.testem.json | 14 | ||||
| -rw-r--r-- | node_modules/console-browserify/.travis.yml | 4 | ||||
| -rw-r--r-- | node_modules/console-browserify/LICENCE | 19 | ||||
| -rw-r--r-- | node_modules/console-browserify/README.md | 33 | ||||
| -rw-r--r-- | node_modules/console-browserify/index.js | 86 | ||||
| -rw-r--r-- | node_modules/console-browserify/package.json | 62 | ||||
| -rw-r--r-- | node_modules/console-browserify/test/index.js | 67 | ||||
| -rw-r--r-- | node_modules/console-browserify/test/static/index.html | 12 | ||||
| -rw-r--r-- | node_modules/console-browserify/test/static/test-adapter.js | 53 | 
10 files changed, 364 insertions, 0 deletions
diff --git a/node_modules/console-browserify/.npmignore b/node_modules/console-browserify/.npmignore new file mode 100644 index 000000000..aa3fd4b85 --- /dev/null +++ b/node_modules/console-browserify/.npmignore @@ -0,0 +1,14 @@ +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript diff --git a/node_modules/console-browserify/.testem.json b/node_modules/console-browserify/.testem.json new file mode 100644 index 000000000..633c2ba84 --- /dev/null +++ b/node_modules/console-browserify/.testem.json @@ -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"] +} diff --git a/node_modules/console-browserify/.travis.yml b/node_modules/console-browserify/.travis.yml new file mode 100644 index 000000000..ed178f635 --- /dev/null +++ b/node_modules/console-browserify/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: +  - 0.8 +  - 0.9 diff --git a/node_modules/console-browserify/LICENCE b/node_modules/console-browserify/LICENCE new file mode 100644 index 000000000..a23e08a85 --- /dev/null +++ b/node_modules/console-browserify/LICENCE @@ -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.
\ No newline at end of file diff --git a/node_modules/console-browserify/README.md b/node_modules/console-browserify/README.md new file mode 100644 index 000000000..572615eb4 --- /dev/null +++ b/node_modules/console-browserify/README.md @@ -0,0 +1,33 @@ +# console-browserify + +[![build status][1]][2] + +[![browser support][3]][4] + + +Emulate console for all the browsers + +## Example + +```js +var console = require("console-browserify") + +console.log("hello world!") +``` + +## Installation + +`npm install console-browserify` + +## Contributors + + - Raynos + +## MIT Licenced + + + +  [1]: https://secure.travis-ci.org/Raynos/console-browserify.png +  [2]: http://travis-ci.org/Raynos/console-browserify +  [3]: http://ci.testling.com/Raynos/console-browserify.png +  [4]: http://ci.testling.com/Raynos/console-browserify diff --git a/node_modules/console-browserify/index.js b/node_modules/console-browserify/index.js new file mode 100644 index 000000000..af433ce8e --- /dev/null +++ b/node_modules/console-browserify/index.js @@ -0,0 +1,86 @@ +/*global window, global*/ +var util = require("util") +var assert = require("assert") +var now = require("date-now") + +var slice = Array.prototype.slice +var console +var times = {} + +if (typeof global !== "undefined" && global.console) { +    console = global.console +} else if (typeof window !== "undefined" && window.console) { +    console = window.console +} else { +    console = {} +} + +var functions = [ +    [log, "log"], +    [info, "info"], +    [warn, "warn"], +    [error, "error"], +    [time, "time"], +    [timeEnd, "timeEnd"], +    [trace, "trace"], +    [dir, "dir"], +    [consoleAssert, "assert"] +] + +for (var i = 0; i < functions.length; i++) { +    var tuple = functions[i] +    var f = tuple[0] +    var name = tuple[1] + +    if (!console[name]) { +        console[name] = f +    } +} + +module.exports = console + +function log() {} + +function info() { +    console.log.apply(console, arguments) +} + +function warn() { +    console.log.apply(console, arguments) +} + +function error() { +    console.warn.apply(console, arguments) +} + +function time(label) { +    times[label] = now() +} + +function timeEnd(label) { +    var time = times[label] +    if (!time) { +        throw new Error("No such label: " + label) +    } + +    var duration = now() - time +    console.log(label + ": " + duration + "ms") +} + +function trace() { +    var err = new Error() +    err.name = "Trace" +    err.message = util.format.apply(null, arguments) +    console.error(err.stack) +} + +function dir(object) { +    console.log(util.inspect(object) + "\n") +} + +function consoleAssert(expression) { +    if (!expression) { +        var arr = slice.call(arguments, 1) +        assert.ok(false, util.format.apply(null, arr)) +    } +} diff --git a/node_modules/console-browserify/package.json b/node_modules/console-browserify/package.json new file mode 100644 index 000000000..860be4fff --- /dev/null +++ b/node_modules/console-browserify/package.json @@ -0,0 +1,62 @@ +{ +  "name": "console-browserify", +  "version": "1.1.0", +  "description": "Emulate console for all the browsers", +  "keywords": [], +  "author": "Raynos <raynos2@gmail.com>", +  "repository": "git://github.com/Raynos/console-browserify.git", +  "main": "index", +  "homepage": "https://github.com/Raynos/console-browserify", +  "contributors": [ +    { +      "name": "Raynos" +    } +  ], +  "bugs": { +    "url": "https://github.com/Raynos/console-browserify/issues", +    "email": "raynos2@gmail.com" +  }, +  "dependencies": { +    "date-now": "^0.1.4" +  }, +  "devDependencies": { +    "tape": "^2.12.3", +    "jsonify": "0.0.0", +    "tap-spec": "^0.1.8", +    "run-browser": "^1.3.0", +    "tap-dot": "^0.2.1" +  }, +  "licenses": [ +    { +      "type": "MIT", +      "url": "http://github.com/Raynos/console-browserify/raw/master/LICENSE" +    } +  ], +  "scripts": { +    "test": "node ./test/index.js | tap-spec", +    "dot": "node ./test/index.js | tap-dot", +    "start": "node ./index.js", +    "cover": "istanbul cover --report none --print detail ./test/index.js", +    "view-cover": "istanbul report html && google-chrome ./coverage/index.html", +    "browser": "run-browser test/index.js", +    "phantom": "run-browser test/index.js -b | tap-spec", +    "build": "browserify test/index.js -o test/static/bundle.js", +    "testem": "testem" +  }, +  "testling": { +    "files": "test/index.js", +    "browsers": [ +      "ie/8..latest", +      "firefox/16..latest", +      "firefox/nightly", +      "chrome/22..latest", +      "chrome/canary", +      "opera/12..latest", +      "opera/next", +      "safari/5.1..latest", +      "ipad/6.0..latest", +      "iphone/6.0..latest", +      "android-browser/4.2..latest" +    ] +  } +} diff --git a/node_modules/console-browserify/test/index.js b/node_modules/console-browserify/test/index.js new file mode 100644 index 000000000..26dfaad6e --- /dev/null +++ b/node_modules/console-browserify/test/index.js @@ -0,0 +1,67 @@ +var console = require("../index") +var test = require("tape") + +if (typeof window !== "undefined" && !window.JSON) { +    window.JSON = require("jsonify") +} + +test("console has expected methods", function (assert) { +    assert.ok(console.log) +    assert.ok(console.info) +    assert.ok(console.warn) +    assert.ok(console.dir) +    assert.ok(console.time, "time") +    assert.ok(console.timeEnd, "timeEnd") +    assert.ok(console.trace, "trace") +    assert.ok(console.assert) + +    assert.end() +}) + +test("invoke console.log", function (assert) { +    console.log("test-log") + +    assert.end() +}) + +test("invoke console.info", function (assert) { +    console.info("test-info") + +    assert.end() +}) + +test("invoke console.warn", function (assert) { +    console.warn("test-warn") +     +    assert.end() +}) + +test("invoke console.time", function (assert) { +    console.time("label") + +    assert.end() +}) + +test("invoke console.trace", function (assert) { +    console.trace("test-trace") + +    assert.end() +}) + +test("invoke console.assert", function (assert) { +    console.assert(true) + +    assert.end() +}) + +test("invoke console.dir", function (assert) { +    console.dir("test-dir") + +    assert.end() +}) + +test("invoke console.timeEnd", function (assert) { +    console.timeEnd("label") + +    assert.end() +}) diff --git a/node_modules/console-browserify/test/static/index.html b/node_modules/console-browserify/test/static/index.html new file mode 100644 index 000000000..dd55012f0 --- /dev/null +++ b/node_modules/console-browserify/test/static/index.html @@ -0,0 +1,12 @@ +<!doctype html> +<html> +<head> +    <meta http-equiv="x-ua-compatible" content="IE=8" > +    <title>TAPE Example</title> +    <script src="/testem.js"></script> +    <script src="test-adapter.js"></script> +    <script src="bundle.js"></script> +</head> +<body> +</body> +</html> diff --git a/node_modules/console-browserify/test/static/test-adapter.js b/node_modules/console-browserify/test/static/test-adapter.js new file mode 100644 index 000000000..8b4c12dc5 --- /dev/null +++ b/node_modules/console-browserify/test/static/test-adapter.js @@ -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 +        } +    } +}())  | 
