[Pkg-javascript-commits] [node-depd] 01/06: New upstream version 1.1.1

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Sat Sep 2 05:43:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-depd.

commit bc544f7f3a6d6a13d94d2b838865a9bd14b532bd
Author: Pirate Praveen <praveen at debian.org>
Date:   Sat Sep 2 10:02:54 2017 +0530

    New upstream version 1.1.1
---
 .eslintignore                                   |   2 +
 .eslintrc                                       |   3 +
 .gitignore                                      |   1 +
 .travis.yml                                     |  35 +++-
 History.md                                      |  15 ++
 LICENSE                                         |   2 +-
 Readme.md                                       |  13 +-
 appveyor.yml                                    |  22 ++-
 benchmark/index.js                              |  32 ++--
 benchmark/wrapfunction.js                       |  12 +-
 benchmark/wrapproperty.js                       |  12 +-
 index.js                                        |  99 ++++++------
 lib/browser/index.js                            |  77 +++++++++
 lib/compat/buffer-concat.js                     |  33 ----
 lib/compat/callsite-tostring.js                 |   8 +-
 lib/compat/event-listener-count.js              |  22 +++
 lib/compat/index.js                             |  30 ++--
 package.json                                    |  13 +-
 test/.eslintrc                                  |   5 +
 test/browserify.js                              | 182 +++++++++++++++++++++
 test/fixtures/{cool-lib.js => libs/cool.js}     |   4 +-
 test/fixtures/libs/index.js                     |  30 ++++
 test/fixtures/libs/multi.js                     |  11 ++
 test/fixtures/{my-lib.js => libs/my.js}         |  11 +-
 test/fixtures/{new-lib.js => libs/new.js}       |   2 +-
 test/fixtures/{old-lib.js => libs/old.js}       |   6 +-
 test/fixtures/{strict-lib.js => libs/strict.js} |  10 +-
 test/fixtures/{thing-lib.js => libs/thing.js}   |   2 +-
 test/fixtures/libs/trace.js                     |  11 ++
 test/fixtures/multi-lib.js                      |  11 --
 test/fixtures/script.js                         |   4 +-
 test/fixtures/trace-lib.js                      |  11 --
 test/support/buffer-concat.js                   |  46 ++++++
 test/support/capture-stderr.js                  |  46 ++++++
 test/test.js                                    | 204 +++++++++++-------------
 35 files changed, 735 insertions(+), 292 deletions(-)

diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..62562b7
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,2 @@
+coverage
+node_modules
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..e3578aa
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,3 @@
+{
+  "extends": "standard"
+}
diff --git a/.gitignore b/.gitignore
index 3cd27af..0fa6951 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 coverage/
 node_modules/
 npm-debug.log
+package-lock.json
diff --git a/.travis.yml b/.travis.yml
index 31d82cf..db7735c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,8 +4,37 @@ node_js:
   - "0.8"
   - "0.10"
   - "0.12"
-  - "1.0"
-  - "1.6"
+  - "1.8"
+  - "2.5"
+  - "3.3"
+  - "4.8"
+  - "5.12"
+  - "6.11"
+  - "7.10"
+  - "8.1"
 sudo: false
-script: "npm run-script test-ci"
+cache:
+  directories:
+    - node_modules
+before_install:
+  # Skip updating shrinkwrap / lock
+  - "npm config set shrinkwrap false"
+
+  # Remove all non-test dependencies
+  - "npm rm --save-dev benchmark beautify-benchmark || true"
+
+  # Setup Node.js version-specific dependencies
+  - "test $TRAVIS_NODE_VERSION != '0.6' || npm rm --save-dev istanbul"
+  - "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
+  - "test $TRAVIS_NODE_VERSION = '0.6' -o $TRAVIS_NODE_VERSION = '0.8' || npm install browserify"
+  - "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-markdown eslint-plugin-promise eslint-plugin-standard"
+
+  # Update Node.js modules
+  - "test ! -d node_modules || npm prune"
+  - "test ! -d node_modules || npm rebuild"
+script:
+  # Run test script, depending on istanbul install
+  - "test ! -z $(npm -ps ls istanbul) || npm test"
+  - "test   -z $(npm -ps ls istanbul) || npm run-script test-ci"
+  - "test   -z $(npm -ps ls eslint  ) || npm run-script lint"
 after_script: "npm install coveralls at 2.10.0 && cat ./coverage/lcov.info | coveralls"
diff --git a/History.md b/History.md
index 4a36a6c..f001649 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,18 @@
+1.1.1 / 2017-07-27
+==================
+
+  * Remove unnecessary `Buffer` loading
+  * Support Node.js 0.6 to 8.x
+
+1.1.0 / 2015-09-14
+==================
+
+  * Enable strict mode in more places
+  * Support io.js 3.x
+  * Support io.js 2.x
+  * Support web browser loading
+    - Requires bundler like Browserify or webpack
+
 1.0.1 / 2015-04-07
 ==================
 
diff --git a/LICENSE b/LICENSE
index b7dce6c..84441fb 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 (The MIT License)
 
-Copyright (c) 2014 Douglas Christopher Wilson
+Copyright (c) 2014-2017 Douglas Christopher Wilson
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/Readme.md b/Readme.md
index 5ead5da..9e7d872 100644
--- a/Readme.md
+++ b/Readme.md
@@ -14,12 +14,21 @@ Deprecate all the things
 
 ## Install
 
+This module is installed directly using `npm`:
+
 ```sh
 $ npm install depd
 ```
 
+This module can also be bundled with systems like
+[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/),
+though by default this module will alter it's API to no longer display or
+track deprecations.
+
 ## API
 
+<!-- eslint-disable no-unused-vars -->
+
 ```js
 var deprecate = require('depd')('my-module')
 ```
@@ -193,7 +202,7 @@ var deprecate = require('depd')('my-cool-module')
 
 // message automatically derived from function name
 // Object.oldfunction
-exports.oldfunction = deprecate.function(function oldfunction() {
+exports.oldfunction = deprecate.function(function oldfunction () {
   // all calls to function are deprecated
 })
 
@@ -269,6 +278,6 @@ deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
 [coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg
 [coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
 [node-image]: https://img.shields.io/node/v/depd.svg
-[node-url]: http://nodejs.org/download/
+[node-url]: https://nodejs.org/en/download/
 [gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
 [gratipay-url]: https://www.gratipay.com/dougwilson/
diff --git a/appveyor.yml b/appveyor.yml
index ba20385..4d12d17 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,14 +3,30 @@ environment:
     - nodejs_version: "0.8"
     - nodejs_version: "0.10"
     - nodejs_version: "0.12"
-    - nodejs_version: "1.0"
-    - nodejs_version: "1.6"
+    - nodejs_version: "1.8"
+    - nodejs_version: "2.5"
+    - nodejs_version: "3.3"
+    - nodejs_version: "4.8"
+    - nodejs_version: "5.12"
+    - nodejs_version: "6.11"
+    - nodejs_version: "7.10"
+    - nodejs_version: "8.1"
+cache:
+  - node_modules
 install:
   - ps: Install-Product node $env:nodejs_version
+  - npm config set shrinkwrap false
+  - npm rm --save-dev benchmark beautify-benchmark & ver > nul
+  - if "%nodejs_version%" equ "0.8" npm rm --save-dev istanbul
+  - npm rm --save-dev eslint eslint-config-standard eslint-plugin-markdown eslint-plugin-promise eslint-plugin-standard
+  - if exist node_modules npm prune
+  - if exist node_modules npm rebuild
   - npm install
 build: off
 test_script:
   - node --version
   - npm --version
-  - npm run test-ci
+  - set npm_test_command=test
+  - for /f %%l in ('npm -ps ls istanbul') do set npm_test_command=test-ci
+  - npm run %npm_test_command%
 version: "{build}"
diff --git a/benchmark/index.js b/benchmark/index.js
index 2fbd813..17cf91a 100644
--- a/benchmark/index.js
+++ b/benchmark/index.js
@@ -1,28 +1,28 @@
-var fs = require('fs');
-var path = require('path');
-var spawn = require('child_process').spawn;
+var fs = require('fs')
+var path = require('path')
+var spawn = require('child_process').spawn
 
-var exe = process.argv[0];
-var cwd = process.cwd();
+var exe = process.argv[0]
+var cwd = process.cwd()
 
-runScripts(fs.readdirSync(__dirname));
+runScripts(fs.readdirSync(__dirname))
 
-function runScripts(fileNames) {
-  var fileName = fileNames.shift();
+function runScripts (fileNames) {
+  var fileName = fileNames.shift()
 
-  if (!fileName) return;
-  if (!/\.js$/i.test(fileName)) return runScripts(fileNames);
-  if (fileName.toLowerCase() === 'index.js') return runScripts(fileNames);
+  if (!fileName) return
+  if (!/\.js$/i.test(fileName)) return runScripts(fileNames)
+  if (fileName.toLowerCase() === 'index.js') return runScripts(fileNames)
 
-  var fullPath = path.join(__dirname, fileName);
+  var fullPath = path.join(__dirname, fileName)
 
-  console.log('> %s %s', exe, path.relative(cwd, fullPath));
+  console.log('> %s %s', exe, path.relative(cwd, fullPath))
 
   var proc = spawn(exe, [fullPath], {
     'stdio': 'inherit'
-  });
+  })
 
   proc.on('exit', function () {
-    runScripts(fileNames);
-  });
+    runScripts(fileNames)
+  })
 }
diff --git a/benchmark/wrapfunction.js b/benchmark/wrapfunction.js
index 405a83d..8a92f37 100644
--- a/benchmark/wrapfunction.js
+++ b/benchmark/wrapfunction.js
@@ -11,9 +11,9 @@ var benchmarks = require('beautify-benchmark')
  */
 
 process.env.NO_DEPRECATION = 'my-lib'
-global.mylib = require('../test/fixtures/my-lib')
+global.mylib = require('../test/fixtures/libs/my')
 
-var suite = new benchmark.Suite
+var suite = new benchmark.Suite()
 
 suite.add({
   name: 'function',
@@ -33,12 +33,12 @@ suite.add({
   fn: 'mylib.old()'
 })
 
-suite.on('cycle', function onCycle(event) {
-  benchmarks.add(event.target);
+suite.on('cycle', function onCycle (event) {
+  benchmarks.add(event.target)
 })
 
-suite.on('complete', function onComplete() {
-  benchmarks.log();
+suite.on('complete', function onComplete () {
+  benchmarks.log()
 })
 
 suite.run({async: false})
diff --git a/benchmark/wrapproperty.js b/benchmark/wrapproperty.js
index 188536b..482bfb6 100644
--- a/benchmark/wrapproperty.js
+++ b/benchmark/wrapproperty.js
@@ -11,9 +11,9 @@ var benchmarks = require('beautify-benchmark')
  */
 
 process.env.NO_DEPRECATION = 'my-lib'
-global.mylib = require('../test/fixtures/my-lib')
+global.mylib = require('../test/fixtures/libs/my')
 
-var suite = new benchmark.Suite
+var suite = new benchmark.Suite()
 
 suite.add({
   name: 'property',
@@ -27,12 +27,12 @@ suite.add({
   fn: 'mylib.propa = mylib.propa'
 })
 
-suite.on('cycle', function onCycle(event) {
-  benchmarks.add(event.target);
+suite.on('cycle', function onCycle (event) {
+  benchmarks.add(event.target)
 })
 
-suite.on('complete', function onComplete() {
-  benchmarks.log();
+suite.on('complete', function onComplete () {
+  benchmarks.log()
 })
 
 suite.run({async: false})
diff --git a/index.js b/index.js
index d183b0a..73d81ab 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
 /*!
  * depd
- * Copyright(c) 2014 Douglas Christopher Wilson
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
  * MIT Licensed
  */
 
@@ -9,7 +9,7 @@
  */
 
 var callSiteToString = require('./lib/compat').callSiteToString
-var EventEmitter = require('events').EventEmitter
+var eventListenerCount = require('./lib/compat').eventListenerCount
 var relative = require('path').relative
 
 /**
@@ -25,24 +25,16 @@ module.exports = depd
 var basePath = process.cwd()
 
 /**
- * Get listener count on event emitter.
- */
-
-/*istanbul ignore next*/
-var eventListenerCount = EventEmitter.listenerCount
-  || function (emitter, type) { return emitter.listeners(type).length }
-
-/**
  * Determine if namespace is contained in the string.
  */
 
-function containsNamespace(str, namespace) {
+function containsNamespace (str, namespace) {
   var val = str.split(/[ ,]+/)
 
   namespace = String(namespace).toLowerCase()
 
-  for (var i = 0 ; i < val.length; i++) {
-    if (!(str = val[i])) continue;
+  for (var i = 0; i < val.length; i++) {
+    if (!(str = val[i])) continue
 
     // namespace contained
     if (str === '*' || str.toLowerCase() === namespace) {
@@ -57,14 +49,14 @@ function containsNamespace(str, namespace) {
  * Convert a data descriptor to accessor descriptor.
  */
 
-function convertDataDescriptorToAccessor(obj, prop, message) {
+function convertDataDescriptorToAccessor (obj, prop, message) {
   var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
   var value = descriptor.value
 
-  descriptor.get = function getter() { return value }
+  descriptor.get = function getter () { return value }
 
   if (descriptor.writable) {
-    descriptor.set = function setter(val) { return value = val }
+    descriptor.set = function setter (val) { return (value = val) }
   }
 
   delete descriptor.value
@@ -79,7 +71,7 @@ function convertDataDescriptorToAccessor(obj, prop, message) {
  * Create arguments string to keep arity.
  */
 
-function createArgumentsString(arity) {
+function createArgumentsString (arity) {
   var str = ''
 
   for (var i = 0; i < arity; i++) {
@@ -93,7 +85,7 @@ function createArgumentsString(arity) {
  * Create stack string from stack.
  */
 
-function createStackString(stack) {
+function createStackString (stack) {
   var str = this.name + ': ' + this.namespace
 
   if (this.message) {
@@ -111,7 +103,7 @@ function createStackString(stack) {
  * Create deprecate for namespace in caller.
  */
 
-function depd(namespace) {
+function depd (namespace) {
   if (!namespace) {
     throw new TypeError('argument namespace is required')
   }
@@ -120,7 +112,7 @@ function depd(namespace) {
   var site = callSiteLocation(stack[1])
   var file = site[0]
 
-  function deprecate(message) {
+  function deprecate (message) {
     // call to self as log
     log.call(deprecate, message)
   }
@@ -141,7 +133,7 @@ function depd(namespace) {
  * Determine if namespace is ignored.
  */
 
-function isignored(namespace) {
+function isignored (namespace) {
   /* istanbul ignore next: tested in a child processs */
   if (process.noDeprecation) {
     // --no-deprecation support
@@ -158,7 +150,7 @@ function isignored(namespace) {
  * Determine if namespace is traced.
  */
 
-function istraced(namespace) {
+function istraced (namespace) {
   /* istanbul ignore next: tested in a child processs */
   if (process.traceDeprecation) {
     // --trace-deprecation support
@@ -175,7 +167,7 @@ function istraced(namespace) {
  * Display deprecation message.
  */
 
-function log(message, site) {
+function log (message, site) {
   var haslisteners = eventListenerCount(process, 'deprecation') !== 0
 
   // abort early if no destination
@@ -248,15 +240,13 @@ function log(message, site) {
     : formatPlain
   var msg = format.call(this, message, caller, stack.slice(i))
   process.stderr.write(msg + '\n', 'utf8')
-
-  return
 }
 
 /**
  * Get call site location as array.
  */
 
-function callSiteLocation(callSite) {
+function callSiteLocation (callSite) {
   var file = callSite.getFileName() || '<anonymous>'
   var line = callSite.getLineNumber()
   var colm = callSite.getColumnNumber()
@@ -277,7 +267,7 @@ function callSiteLocation(callSite) {
  * Generate a default message from the site.
  */
 
-function defaultMessage(site) {
+function defaultMessage (site) {
   var callSite = site.callSite
   var funcName = site.name
 
@@ -308,12 +298,12 @@ function defaultMessage(site) {
  * Format deprecation message without color.
  */
 
-function formatPlain(msg, caller, stack) {
+function formatPlain (msg, caller, stack) {
   var timestamp = new Date().toUTCString()
 
-  var formatted = timestamp
-    + ' ' + this._namespace
-    + ' deprecated ' + msg
+  var formatted = timestamp +
+    ' ' + this._namespace +
+    ' deprecated ' + msg
 
   // add stack trace
   if (this._traced) {
@@ -335,10 +325,10 @@ function formatPlain(msg, caller, stack) {
  * Format deprecation message with color.
  */
 
-function formatColor(msg, caller, stack) {
-  var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan
-    + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow
-    + ' \x1b[0m' + msg + '\x1b[39m' // reset
+function formatColor (msg, caller, stack) {
+  var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
+    ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
+    ' \x1b[0m' + msg + '\x1b[39m' // reset
 
   // add stack trace
   if (this._traced) {
@@ -360,17 +350,17 @@ function formatColor(msg, caller, stack) {
  * Format call site location.
  */
 
-function formatLocation(callSite) {
-  return relative(basePath, callSite[0])
-    + ':' + callSite[1]
-    + ':' + callSite[2]
+function formatLocation (callSite) {
+  return relative(basePath, callSite[0]) +
+    ':' + callSite[1] +
+    ':' + callSite[2]
 }
 
 /**
  * Get the stack as array of call sites.
  */
 
-function getStack() {
+function getStack () {
   var limit = Error.stackTraceLimit
   var obj = {}
   var prep = Error.prepareStackTrace
@@ -394,7 +384,7 @@ function getStack() {
  * Capture call site stack from v8.
  */
 
-function prepareObjectStackTrace(obj, stack) {
+function prepareObjectStackTrace (obj, stack) {
   return stack
 }
 
@@ -402,23 +392,24 @@ function prepareObjectStackTrace(obj, stack) {
  * Return a wrapped function in a deprecation message.
  */
 
-function wrapfunction(fn, message) {
+function wrapfunction (fn, message) {
   if (typeof fn !== 'function') {
     throw new TypeError('argument fn must be a function')
   }
 
   var args = createArgumentsString(fn.length)
-  var deprecate = this
+  var deprecate = this // eslint-disable-line no-unused-vars
   var stack = getStack()
   var site = callSiteLocation(stack[1])
 
   site.name = fn.name
 
-  var deprecatedfn = eval('(function (' + args + ') {\n'
-    + '"use strict"\n'
-    + 'log.call(deprecate, message, site)\n'
-    + 'return fn.apply(this, arguments)\n'
-    + '})')
+   // eslint-disable-next-line no-eval
+  var deprecatedfn = eval('(function (' + args + ') {\n' +
+    '"use strict"\n' +
+    'log.call(deprecate, message, site)\n' +
+    'return fn.apply(this, arguments)\n' +
+    '})')
 
   return deprecatedfn
 }
@@ -427,7 +418,7 @@ function wrapfunction(fn, message) {
  * Wrap property in a deprecation message.
  */
 
-function wrapproperty(obj, prop, message) {
+function wrapproperty (obj, prop, message) {
   if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
     throw new TypeError('argument obj must be object')
   }
@@ -459,7 +450,7 @@ function wrapproperty(obj, prop, message) {
 
   // wrap getter
   if (typeof get === 'function') {
-    descriptor.get = function getter() {
+    descriptor.get = function getter () {
       log.call(deprecate, message, site)
       return get.apply(this, arguments)
     }
@@ -467,7 +458,7 @@ function wrapproperty(obj, prop, message) {
 
   // wrap setter
   if (typeof set === 'function') {
-    descriptor.set = function setter() {
+    descriptor.set = function setter () {
       log.call(deprecate, message, site)
       return set.apply(this, arguments)
     }
@@ -480,7 +471,7 @@ function wrapproperty(obj, prop, message) {
  * Create DeprecationError for deprecation
  */
 
-function DeprecationError(namespace, message, stack) {
+function DeprecationError (namespace, message, stack) {
   var error = new Error()
   var stackString
 
@@ -518,9 +509,9 @@ function DeprecationError(namespace, message, stack) {
       }
 
       // prepare stack trace
-      return stackString = createStackString.call(this, stack)
+      return (stackString = createStackString.call(this, stack))
     },
-    set: function setter(val) {
+    set: function setter (val) {
       stackString = val
     }
   })
diff --git a/lib/browser/index.js b/lib/browser/index.js
new file mode 100644
index 0000000..6be45cc
--- /dev/null
+++ b/lib/browser/index.js
@@ -0,0 +1,77 @@
+/*!
+ * depd
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = depd
+
+/**
+ * Create deprecate for namespace in caller.
+ */
+
+function depd (namespace) {
+  if (!namespace) {
+    throw new TypeError('argument namespace is required')
+  }
+
+  function deprecate (message) {
+    // no-op in browser
+  }
+
+  deprecate._file = undefined
+  deprecate._ignored = true
+  deprecate._namespace = namespace
+  deprecate._traced = false
+  deprecate._warned = Object.create(null)
+
+  deprecate.function = wrapfunction
+  deprecate.property = wrapproperty
+
+  return deprecate
+}
+
+/**
+ * Return a wrapped function in a deprecation message.
+ *
+ * This is a no-op version of the wrapper, which does nothing but call
+ * validation.
+ */
+
+function wrapfunction (fn, message) {
+  if (typeof fn !== 'function') {
+    throw new TypeError('argument fn must be a function')
+  }
+
+  return fn
+}
+
+/**
+ * Wrap property in a deprecation message.
+ *
+ * This is a no-op version of the wrapper, which does nothing but call
+ * validation.
+ */
+
+function wrapproperty (obj, prop, message) {
+  if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
+    throw new TypeError('argument obj must be object')
+  }
+
+  var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
+
+  if (!descriptor) {
+    throw new TypeError('must call property on owner object')
+  }
+
+  if (!descriptor.configurable) {
+    throw new TypeError('property must be configurable')
+  }
+}
diff --git a/lib/compat/buffer-concat.js b/lib/compat/buffer-concat.js
deleted file mode 100644
index 09d9721..0000000
--- a/lib/compat/buffer-concat.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*!
- * depd
- * Copyright(c) 2014 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-/**
- * Module exports.
- */
-
-module.exports = bufferConcat
-
-/**
- * Concatenate an array of Buffers.
- */
-
-function bufferConcat(bufs) {
-  var length = 0
-
-  for (var i = 0, len = bufs.length; i < len; i++) {
-    length += bufs[i].length
-  }
-
-  var buf = new Buffer(length)
-  var pos = 0
-
-  for (var i = 0, len = bufs.length; i < len; i++) {
-    bufs[i].copy(buf, pos)
-    pos += bufs[i].length
-  }
-
-  return buf
-}
diff --git a/lib/compat/callsite-tostring.js b/lib/compat/callsite-tostring.js
index 17cf7ed..73186dc 100644
--- a/lib/compat/callsite-tostring.js
+++ b/lib/compat/callsite-tostring.js
@@ -4,6 +4,8 @@
  * MIT Licensed
  */
 
+'use strict'
+
 /**
  * Module exports.
  */
@@ -14,7 +16,7 @@ module.exports = callSiteToString
  * Format a CallSite file location to a string.
  */
 
-function callSiteFileLocation(callSite) {
+function callSiteFileLocation (callSite) {
   var fileName
   var fileLocation = ''
 
@@ -50,7 +52,7 @@ function callSiteFileLocation(callSite) {
  * Format a CallSite to a string.
  */
 
-function callSiteToString(callSite) {
+function callSiteToString (callSite) {
   var addSuffix = true
   var fileLocation = callSiteFileLocation(callSite)
   var functionName = callSite.getFunctionName()
@@ -95,7 +97,7 @@ function callSiteToString(callSite) {
  * Get constructor name of reviver.
  */
 
-function getConstructorName(obj) {
+function getConstructorName (obj) {
   var receiver = obj.receiver
   return (receiver.constructor && receiver.constructor.name) || null
 }
diff --git a/lib/compat/event-listener-count.js b/lib/compat/event-listener-count.js
new file mode 100644
index 0000000..3a8925d
--- /dev/null
+++ b/lib/compat/event-listener-count.js
@@ -0,0 +1,22 @@
+/*!
+ * depd
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = eventListenerCount
+
+/**
+ * Get the count of listeners on an event emitter of a specific type.
+ */
+
+function eventListenerCount (emitter, type) {
+  return emitter.listeners(type).length
+}
diff --git a/lib/compat/index.js b/lib/compat/index.js
index 7fee026..955b333 100644
--- a/lib/compat/index.js
+++ b/lib/compat/index.js
@@ -1,23 +1,29 @@
 /*!
  * depd
- * Copyright(c) 2014 Douglas Christopher Wilson
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
  * MIT Licensed
  */
 
+'use strict'
+
 /**
- * Module exports.
+ * Module dependencies.
+ * @private
  */
 
-lazyProperty(module.exports, 'bufferConcat', function bufferConcat() {
-  return Buffer.concat || require('./buffer-concat')
-})
+var EventEmitter = require('events').EventEmitter
 
-lazyProperty(module.exports, 'callSiteToString', function callSiteToString() {
+/**
+ * Module exports.
+ * @public
+ */
+
+lazyProperty(module.exports, 'callSiteToString', function callSiteToString () {
   var limit = Error.stackTraceLimit
   var obj = {}
   var prep = Error.prepareStackTrace
 
-  function prepareObjectStackTrace(obj, stack) {
+  function prepareObjectStackTrace (obj, stack) {
     return stack
   }
 
@@ -36,12 +42,16 @@ lazyProperty(module.exports, 'callSiteToString', function callSiteToString() {
   return stack[0].toString ? toString : require('./callsite-tostring')
 })
 
+lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount () {
+  return EventEmitter.listenerCount || require('./event-listener-count')
+})
+
 /**
  * Define a lazy property.
  */
 
-function lazyProperty(obj, prop, getter) {
-  function get() {
+function lazyProperty (obj, prop, getter) {
+  function get () {
     var val = getter()
 
     Object.defineProperty(obj, prop, {
@@ -64,6 +74,6 @@ function lazyProperty(obj, prop, getter) {
  * Call toString() on the obj
  */
 
-function toString(obj) {
+function toString (obj) {
   return obj.toString()
 }
diff --git a/package.json b/package.json
index 9e9e402..b6994a3 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "depd",
   "description": "Deprecate all the things",
-  "version": "1.0.1",
+  "version": "1.1.1",
   "author": "Douglas Christopher Wilson <doug at somethingdoug.com>",
   "license": "MIT",
   "keywords": [
@@ -9,10 +9,16 @@
     "deprecated"
   ],
   "repository": "dougwilson/nodejs-depd",
+  "browser": "lib/browser/index.js",
   "devDependencies": {
-    "benchmark": "1.0.0",
+    "benchmark": "2.1.4",
     "beautify-benchmark": "0.2.4",
-    "istanbul": "0.3.5",
+    "eslint": "3.19.0",
+    "eslint-config-standard": "7.1.0",
+    "eslint-plugin-markdown": "1.0.0-beta.7",
+    "eslint-plugin-promise": "3.5.0",
+    "eslint-plugin-standard": "2.3.1",
+    "istanbul": "0.4.5",
     "mocha": "~1.21.5"
   },
   "files": [
@@ -27,6 +33,7 @@
   },
   "scripts": {
     "bench": "node benchmark/index.js",
+    "lint": "eslint --plugin markdown --ext js,md .",
     "test": "mocha --reporter spec --bail test/",
     "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/",
     "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/"
diff --git a/test/.eslintrc b/test/.eslintrc
new file mode 100644
index 0000000..29c15b0
--- /dev/null
+++ b/test/.eslintrc
@@ -0,0 +1,5 @@
+{
+  "env": {
+	  "mocha": true
+  }
+}
diff --git a/test/browserify.js b/test/browserify.js
new file mode 100644
index 0000000..a9b94bd
--- /dev/null
+++ b/test/browserify.js
@@ -0,0 +1,182 @@
+
+var assert = require('assert')
+var browserify = tryRequire('browserify')
+var captureStderr = require('./support/capture-stderr')
+var depd = null
+var mylib = null
+var path = require('path')
+var run = browserify ? describe : describe.skip
+
+run('when browserified', function () {
+  before(function (done) {
+    var b = browserify()
+
+    // require depd
+    b.require(path.join(__dirname, '..'), {
+      expose: 'depd'
+    })
+
+    // require libs
+    b.require(path.join(__dirname, 'fixtures', 'libs'), {
+      expose: 'libs'
+    })
+
+    b.bundle(function (err, buf) {
+      if (err) return done(err)
+      var require = eval(buf.toString()) // eslint-disable-line no-eval
+      depd = require('depd')
+      mylib = require('libs').my
+      done()
+    })
+  })
+
+  describe('depd(namespace)', function () {
+    it('creates deprecated function', function () {
+      assert.equal(typeof depd('test'), 'function')
+    })
+
+    it('requires namespace', function () {
+      assert.throws(depd.bind(null), /namespace.*required/)
+    })
+  })
+
+  describe('deprecate(message)', function () {
+    it('should not log message', function () {
+      function callold () { mylib.old() }
+      assert.equal(captureStderr(callold), '')
+    })
+
+    describe('when message omitted', function () {
+      it('should not log message', function () {
+        function callold () { mylib.automsgnamed() }
+        assert.equal(captureStderr(callold), '')
+      })
+    })
+  })
+
+  describe('deprecate.function(fn, message)', function () {
+    it('should throw when not given function', function () {
+      var deprecate = depd('test')
+      assert.throws(deprecate.function.bind(deprecate, 2), /fn.*function/)
+    })
+
+    it('should not log on call to function', function () {
+      function callold () { mylib.oldfn() }
+      assert.equal(captureStderr(callold), '')
+    })
+
+    it('should have same arity', function () {
+      assert.equal(mylib.oldfn.length, 2)
+    })
+
+    it('should pass arguments', function () {
+      var ret
+      function callold () { ret = mylib.oldfn(1, 2) }
+      assert.equal(captureStderr(callold), '')
+      assert.equal(ret, 2)
+    })
+
+    describe('when message omitted', function () {
+      it('should not log message', function () {
+        function callold () { mylib.oldfnauto() }
+        assert.equal(captureStderr(callold), '')
+      })
+    })
+  })
+
+  describe('deprecate.property(obj, prop, message)', function () {
+    it('should throw when given primitive', function () {
+      var deprecate = depd('test')
+      assert.throws(deprecate.property.bind(deprecate, 2), /obj.*object/)
+    })
+
+    it('should throw when given missing property', function () {
+      var deprecate = depd('test')
+      var obj = {}
+      assert.throws(deprecate.property.bind(deprecate, obj, 'blargh'), /property.*owner/)
+    })
+
+    it('should throw when given non-configurable property', function () {
+      var deprecate = depd('test')
+      var obj = {}
+      Object.defineProperty(obj, 'thing', {value: 'thingie'})
+      assert.throws(deprecate.property.bind(deprecate, obj, 'thing'), /property.*configurable/)
+    })
+
+    it('should not log on access to property', function () {
+      function callprop () { return mylib.propa }
+      assert.equal(captureStderr(callprop), '')
+    })
+
+    it('should not log on setting property', function () {
+      var val
+      function callprop () { val = mylib.propa }
+      function setprop () { mylib.propa = 'newval' }
+      assert.equal(captureStderr(setprop), '')
+      assert.equal(captureStderr(callprop), '')
+      assert.equal(val, 'newval')
+    })
+
+    describe('when obj is a function', function () {
+      it('should not log on access to property on function', function () {
+        function callprop () { return mylib.fnprop.propa }
+        assert.equal(captureStderr(callprop), '')
+      })
+
+      it('should not generate message on named function', function () {
+        function callprop () { return mylib.fnprop.propautomsg }
+        assert.equal(captureStderr(callprop), '')
+      })
+    })
+
+    describe('when value descriptor', function () {
+      it('should not log on access and set', function () {
+        function callold () { return mylib.propa }
+        function setold () { mylib.propa = 'val' }
+        assert.equal(captureStderr(callold), '')
+        assert.equal(captureStderr(setold), '')
+      })
+
+      it('should not log on set to non-writable', function () {
+        function callold () { return mylib.propget }
+        function setold () { mylib.propget = 'val' }
+        assert.equal(captureStderr(callold), '')
+        assert.equal(captureStderr(setold), '')
+      })
+    })
+
+    describe('when accessor descriptor', function () {
+      it('should log on access and set', function () {
+        function callold () { return mylib.propdyn }
+        function setold () { mylib.propdyn = 'val' }
+        assert.equal(captureStderr(callold), '')
+        assert.equal(captureStderr(setold), '')
+      })
+
+      it('should not log on access when no accessor', function () {
+        function callold () { return mylib.propsetter }
+        assert.equal(captureStderr(callold), '')
+      })
+
+      it('should not log on set when no setter', function () {
+        function callold () { mylib.propgetter = 'val' }
+        assert.equal(captureStderr(callold), '')
+      })
+    })
+
+    describe('when message omitted', function () {
+      it('should not generate message for method call on named function', function () {
+        function callold () { return mylib.propauto }
+        assert.equal(captureStderr(callold), '')
+      })
+    })
+  })
+})
+
+function tryRequire (name) {
+  try {
+    return require(name)
+  } catch (e) {
+    return undefined
+  }
+}
diff --git a/test/fixtures/cool-lib.js b/test/fixtures/libs/cool.js
similarity index 52%
rename from test/fixtures/cool-lib.js
rename to test/fixtures/libs/cool.js
index e8ed86b..8ba8937 100644
--- a/test/fixtures/cool-lib.js
+++ b/test/fixtures/libs/cool.js
@@ -1,6 +1,6 @@
 
-var deprecate1 = require('../..')('cool-lib')
-var deprecate2 = require('../..')('neat-lib')
+var deprecate1 = require('../../..')('cool-lib')
+var deprecate2 = require('../../..')('neat-lib')
 
 exports.cool = function () {
   deprecate1('cool')
diff --git a/test/fixtures/libs/index.js b/test/fixtures/libs/index.js
new file mode 100644
index 0000000..9be913f
--- /dev/null
+++ b/test/fixtures/libs/index.js
@@ -0,0 +1,30 @@
+
+exports.my = require('./my')
+exports.strict = require('./strict')
+
+lazyRequireProperty(exports, 'cool', './cool')
+lazyRequireProperty(exports, 'multi', './multi')
+lazyRequireProperty(exports, 'new', './new')
+lazyRequireProperty(exports, 'old', './old')
+lazyRequireProperty(exports, 'thing', './thing')
+lazyRequireProperty(exports, 'trace', './trace')
+
+function lazyRequireProperty (obj, prop, path) {
+  function get () {
+    var val = require(path)
+
+    Object.defineProperty(obj, prop, {
+      configurable: true,
+      enumerable: true,
+      value: val
+    })
+
+    return val
+  }
+
+  Object.defineProperty(obj, prop, {
+    configurable: true,
+    enumerable: true,
+    get: get
+  })
+}
diff --git a/test/fixtures/libs/multi.js b/test/fixtures/libs/multi.js
new file mode 100644
index 0000000..e7ecfc9
--- /dev/null
+++ b/test/fixtures/libs/multi.js
@@ -0,0 +1,11 @@
+
+var deprecate1 = require('../../..')('multi-lib')
+var deprecate2 = require('../../..')('multi-lib-other')
+
+exports.old = function () {
+  deprecate1('old')
+}
+
+exports.old2 = function () {
+  deprecate2('old2')
+}
diff --git a/test/fixtures/my-lib.js b/test/fixtures/libs/my.js
similarity index 86%
rename from test/fixtures/my-lib.js
rename to test/fixtures/libs/my.js
index d45a903..5610e2f 100644
--- a/test/fixtures/my-lib.js
+++ b/test/fixtures/libs/my.js
@@ -1,5 +1,5 @@
 
-var deprecate = require('../..')('my-lib')
+var deprecate = require('../../..')('my-lib')
 
 exports.fn = fn
 exports.prop = 'thingie'
@@ -38,6 +38,7 @@ Object.defineProperty(exports, 'propgetter', {
   get: function () { return 'thingie' }
 })
 
+// eslint-disable-next-line accessor-pairs
 Object.defineProperty(exports, 'propsetter', {
   configurable: true,
   set: function () {}
@@ -54,7 +55,7 @@ exports.automsg = function () {
   deprecate()
 }
 
-exports.automsgnamed = function automsgnamed() {
+exports.automsgnamed = function automsgnamed () {
   deprecate()
 }
 
@@ -62,7 +63,7 @@ exports.automsganon = function () {
   (function () { deprecate() }())
 }
 
-exports.fnprop = function thefn() {}
+exports.fnprop = function thefn () {}
 exports.fnprop.propa = 'thingie'
 exports.fnprop.propautomsg = 'thingie'
 
@@ -74,9 +75,9 @@ exports.layerfn = function () {
 }
 
 exports.layerprop = function () {
-  exports.propa
+  return exports.propa
 }
 
-function fn(a1, a2) {
+function fn (a1, a2) {
   return a2
 }
diff --git a/test/fixtures/new-lib.js b/test/fixtures/libs/new.js
similarity index 52%
rename from test/fixtures/new-lib.js
rename to test/fixtures/libs/new.js
index f9593a1..4c1167b 100644
--- a/test/fixtures/new-lib.js
+++ b/test/fixtures/libs/new.js
@@ -1,5 +1,5 @@
 
-var deprecate = require('../..')('new-lib')
+var deprecate = require('../../..')('new-lib')
 
 exports.old = function () {
   deprecate('old')
diff --git a/test/fixtures/old-lib.js b/test/fixtures/libs/old.js
similarity index 52%
rename from test/fixtures/old-lib.js
rename to test/fixtures/libs/old.js
index 44dcf11..f2642c7 100644
--- a/test/fixtures/old-lib.js
+++ b/test/fixtures/libs/old.js
@@ -1,7 +1,7 @@
 
-var deprecate1 = require('../..')('old-lib')
-var deprecate2 = require('../..')('old-lib-other')
-var deprecate3 = require('../..')('my-cool-module')
+var deprecate1 = require('../../..')('old-lib')
+var deprecate2 = require('../../..')('old-lib-other')
+var deprecate3 = require('../../..')('my-cool-module')
 
 exports.old = function () {
   deprecate1('old')
diff --git a/test/fixtures/strict-lib.js b/test/fixtures/libs/strict.js
similarity index 81%
rename from test/fixtures/strict-lib.js
rename to test/fixtures/libs/strict.js
index f4f0201..6177b7d 100644
--- a/test/fixtures/strict-lib.js
+++ b/test/fixtures/libs/strict.js
@@ -1,7 +1,7 @@
 
 'use strict'
 
-var deprecate = require('../..')('strict-lib')
+var deprecate = require('../../..')('strict-lib')
 
 exports.old = function () {
   deprecate('old')
@@ -23,7 +23,7 @@ exports.automsg = function () {
   deprecate()
 }
 
-exports.automsgnamed = function automsgnamed() {
+exports.automsgnamed = function automsgnamed () {
   deprecate()
 }
 
@@ -31,7 +31,7 @@ exports.automsganon = function () {
   (function () { deprecate() }())
 }
 
-exports.fnprop = function thefn() {}
+exports.fnprop = function thefn () {}
 exports.fnprop.propa = 'thingie'
 exports.fnprop.propautomsg = 'thingie'
 
@@ -43,9 +43,9 @@ exports.layerfn = function () {
 }
 
 exports.layerprop = function () {
-  exports.propa
+  return exports.propa
 }
 
-function fn(a1, a2) {
+function fn (a1, a2) {
   return a2
 }
diff --git a/test/fixtures/thing-lib.js b/test/fixtures/libs/thing.js
similarity index 51%
rename from test/fixtures/thing-lib.js
rename to test/fixtures/libs/thing.js
index 6d757a6..34f8e98 100644
--- a/test/fixtures/thing-lib.js
+++ b/test/fixtures/libs/thing.js
@@ -1,5 +1,5 @@
 
-var deprecate = require('../..')('thing-lib')
+var deprecate = require('../../..')('thing-lib')
 
 exports.old = function () {
   deprecate('old')
diff --git a/test/fixtures/libs/trace.js b/test/fixtures/libs/trace.js
new file mode 100644
index 0000000..2cb6c2f
--- /dev/null
+++ b/test/fixtures/libs/trace.js
@@ -0,0 +1,11 @@
+
+var deprecate1 = require('../../..')('trace-lib')
+var deprecate2 = require('../../..')('trace-lib-other')
+
+exports.old = function () {
+  deprecate1('old')
+}
+
+exports.old2 = function () {
+  deprecate2('old2')
+}
diff --git a/test/fixtures/multi-lib.js b/test/fixtures/multi-lib.js
deleted file mode 100644
index 7129761..0000000
--- a/test/fixtures/multi-lib.js
+++ /dev/null
@@ -1,11 +0,0 @@
-
-var deprecate1 = require('../..')('multi-lib')
-var deprecate2 = require('../..')('multi-lib-other')
-
-exports.old = function () {
-  deprecate1('old')
-}
-
-exports.old2 = function () {
-  deprecate2('old2')
-}
diff --git a/test/fixtures/script.js b/test/fixtures/script.js
index db149b6..9364b3a 100644
--- a/test/fixtures/script.js
+++ b/test/fixtures/script.js
@@ -1,8 +1,8 @@
 
-var oldlib = require('./old-lib')
+var oldlib = require('./libs/old')
 
 run()
 
-function run() {
+function run () {
   oldlib.oldfunction()
 }
diff --git a/test/fixtures/trace-lib.js b/test/fixtures/trace-lib.js
deleted file mode 100644
index 89c04d7..0000000
--- a/test/fixtures/trace-lib.js
+++ /dev/null
@@ -1,11 +0,0 @@
-
-var deprecate1 = require('../..')('trace-lib')
-var deprecate2 = require('../..')('trace-lib-other')
-
-exports.old = function () {
-  deprecate1('old')
-}
-
-exports.old2 = function () {
-  deprecate2('old2')
-}
diff --git a/test/support/buffer-concat.js b/test/support/buffer-concat.js
new file mode 100644
index 0000000..93d3477
--- /dev/null
+++ b/test/support/buffer-concat.js
@@ -0,0 +1,46 @@
+/*!
+ * depd
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var Buffer = require('buffer').Buffer
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = Buffer.concat || bufferConcat
+
+/**
+ * Concatenate an array of Buffers.
+ * @public
+ */
+
+function bufferConcat (bufs) {
+  var i
+  var len
+  var length = 0
+
+  for (i = 0, len = bufs.length; i < len; i++) {
+    length += bufs[i].length
+  }
+
+  var buf = new Buffer(length)
+  var pos = 0
+
+  for (i = 0, len = bufs.length; i < len; i++) {
+    bufs[i].copy(buf, pos)
+    pos += bufs[i].length
+  }
+
+  return buf
+}
diff --git a/test/support/capture-stderr.js b/test/support/capture-stderr.js
new file mode 100644
index 0000000..f167b9d
--- /dev/null
+++ b/test/support/capture-stderr.js
@@ -0,0 +1,46 @@
+/*!
+ * depd
+ * Copyright(c) 2017 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var bufferConcat = require('./buffer-concat')
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = captureStderr
+
+/**
+ * Capture STDERR output during a function invokation.
+ * @public
+ */
+
+function captureStderr (fn, color) {
+  var chunks = []
+  var isTTY = process.stderr.isTTY
+  var write = process.stderr.write
+
+  process.stderr.isTTY = Boolean(color)
+  process.stderr.write = function write (chunk, encoding) {
+    chunks.push(new Buffer(chunk, encoding))
+  }
+
+  try {
+    fn()
+  } finally {
+    process.stderr.isTTY = isTTY
+    process.stderr.write = write
+  }
+
+  return bufferConcat(chunks).toString('utf8')
+}
diff --git a/test/test.js b/test/test.js
index a484c55..5288f0c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,13 +1,15 @@
 
 var assert = require('assert')
 var basename = require('path').basename
-var bufferConcat = require('../lib/compat').bufferConcat
+var bufferConcat = require('./support/buffer-concat')
+var captureStderr = require('./support/capture-stderr')
 var depd = require('..')
-var mylib = require('./fixtures/my-lib')
+var libs = require('./fixtures/libs')
+var mylib = libs.my
 var path = require('path')
 var script = path.join(__dirname, 'fixtures', 'script.js')
 var spawn = require('child_process').spawn
-var strictlib = require('./fixtures/strict-lib')
+var strictlib = libs.strict
 
 describe('depd(namespace)', function () {
   it('creates deprecated function', function () {
@@ -21,36 +23,36 @@ describe('depd(namespace)', function () {
 
 describe('deprecate(message)', function () {
   it('should log namespace', function () {
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     assert.ok(captureStderr(callold).indexOf('my-lib') !== -1)
   })
 
   it('should log deprecation', function () {
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     assert.ok(captureStderr(callold).indexOf('deprecate') !== -1)
   })
 
   it('should log message', function () {
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     assert.ok(captureStderr(callold).indexOf('old') !== -1)
   })
 
   it('should log call site', function () {
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(basename(__filename)) !== -1)
     assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should log call site from strict lib', function () {
-    function callold() { strictlib.old() }
+    function callold () { strictlib.old() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(basename(__filename)) !== -1)
     assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should log call site regardless of Error.stackTraceLimit', function () {
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     var limit = Error.stackTraceLimit
     try {
       Error.stackTraceLimit = 1
@@ -63,7 +65,7 @@ describe('deprecate(message)', function () {
   })
 
   it('should log call site within eval', function () {
-    function callold() { eval('mylib.old()') }
+    function callold () { eval('mylib.old()') } // eslint-disable-line no-eval
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(basename(__filename)) !== -1)
     assert.ok(stderr.indexOf('<anonymous>:1:') !== -1)
@@ -71,14 +73,14 @@ describe('deprecate(message)', function () {
   })
 
   it('should log call site within strict', function () {
-    function callold() { 'use strict'; mylib.old() }
+    function callold () { 'use strict'; mylib.old() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(basename(__filename)) !== -1)
     assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should only warn once per call site', function () {
-    function callold() {
+    function callold () {
       for (var i = 0; i < 5; i++) {
         mylib.old() // single call site
         process.stderr.write('invoke ' + i + '\n')
@@ -93,7 +95,7 @@ describe('deprecate(message)', function () {
   it('should warn for different fns on same call site', function () {
     var prop
 
-    function callold() {
+    function callold () {
       mylib[prop]() // call from same site
     }
 
@@ -105,8 +107,8 @@ describe('deprecate(message)', function () {
   })
 
   it('should warn for different calls on same line', function () {
-    function callold() {
-      mylib.old(), mylib.old()
+    function callold () {
+      mylib.old(); mylib.old()
     }
 
     var stderr = captureStderr(callold)
@@ -118,7 +120,7 @@ describe('deprecate(message)', function () {
 
   describe('when message omitted', function () {
     it('should generate message for method call on named function', function () {
-      function callold() { mylib.automsgnamed() }
+      function callold () { mylib.automsgnamed() }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
@@ -126,7 +128,7 @@ describe('deprecate(message)', function () {
     })
 
     it('should generate message for function call on named function', function () {
-      function callold() {
+      function callold () {
         var fn = mylib.automsgnamed
         fn()
       }
@@ -137,7 +139,7 @@ describe('deprecate(message)', function () {
     })
 
     it('should generate message for method call on unnamed function', function () {
-      function callold() { mylib.automsg() }
+      function callold () { mylib.automsg() }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
@@ -145,7 +147,7 @@ describe('deprecate(message)', function () {
     })
 
     it('should generate message for function call on unnamed function', function () {
-      function callold() {
+      function callold () {
         var fn = mylib.automsg
         fn()
       }
@@ -156,16 +158,16 @@ describe('deprecate(message)', function () {
     })
 
     it('should generate message for function call on anonymous function', function () {
-      function callold() { mylib.automsganon() }
+      function callold () { mylib.automsganon() }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
-      assert.ok(/ exports\.automsganon | <anonymous@[^:]+:[0-9]+:[0-9]+> /.test(stderr))
+      assert.ok(/ exports\.automsganon | <anonymous@[^\\/]+[^:]+:[0-9]+:[0-9]+> /.test(stderr))
     })
 
     describe('in strict mode library', function () {
       it('should generate message for method call on named function', function () {
-        function callold() { strictlib.automsgnamed() }
+        function callold () { strictlib.automsgnamed() }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
@@ -173,7 +175,7 @@ describe('deprecate(message)', function () {
       })
 
       it('should generate message for function call on named function', function () {
-        function callold() {
+        function callold () {
           var fn = strictlib.automsgnamed
           fn()
         }
@@ -184,7 +186,7 @@ describe('deprecate(message)', function () {
       })
 
       it('should generate message for method call on unnamed function', function () {
-        function callold() { strictlib.automsg() }
+        function callold () { strictlib.automsg() }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
@@ -192,7 +194,7 @@ describe('deprecate(message)', function () {
       })
 
       it('should generate message for function call on unnamed function', function () {
-        function callold() {
+        function callold () {
           var fn = strictlib.automsg
           fn()
         }
@@ -203,11 +205,11 @@ describe('deprecate(message)', function () {
       })
 
       it('should generate message for function call on anonymous function', function () {
-        function callold() { strictlib.automsganon() }
+        function callold () { strictlib.automsganon() }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
-        assert.ok(/ exports\.automsganon | <anonymous@[^:]+:[0-9]+:[0-9]+> /.test(stderr))
+        assert.ok(/ exports\.automsganon | <anonymous@[^\\/]+[^:]+:[0-9]+:[0-9]+> /.test(stderr))
       })
     })
   })
@@ -215,7 +217,7 @@ describe('deprecate(message)', function () {
   describe('when output supports colors', function () {
     var stderr
     before(function () {
-      function callold() { mylib.old() }
+      function callold () { mylib.old() }
       stderr = captureStderr(callold, true)
     })
 
@@ -245,7 +247,7 @@ describe('deprecate(message)', function () {
   describe('when output does not support colors', function () {
     var stderr
     before(function () {
-      function callold() { mylib.old() }
+      function callold () { mylib.old() }
       stderr = captureStderr(callold, false)
     })
 
@@ -284,7 +286,7 @@ describe('deprecate.function(fn, message)', function () {
   })
 
   it('should log on call to function', function () {
-    function callold() { mylib.oldfn() }
+    function callold () { mylib.oldfn() }
     assert.ok(captureStderr(callold).indexOf(' oldfn ') !== -1)
   })
 
@@ -294,27 +296,27 @@ describe('deprecate.function(fn, message)', function () {
 
   it('should pass arguments', function () {
     var ret
-    function callold() { ret = mylib.oldfn(1, 2) }
+    function callold () { ret = mylib.oldfn(1, 2) }
     assert.ok(captureStderr(callold).indexOf(' oldfn ') !== -1)
     assert.equal(ret, 2)
   })
 
   it('should show call site outside scope', function () {
-    function callold() { mylib.layerfn() }
+    function callold () { mylib.layerfn() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(' oldfn ') !== -1)
     assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should show call site outside scope from strict lib', function () {
-    function callold() { strictlib.layerfn() }
+    function callold () { strictlib.layerfn() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(' oldfn ') !== -1)
     assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should only warn once per call site', function () {
-    function callold() {
+    function callold () {
       for (var i = 0; i < 5; i++) {
         mylib.oldfn() // single call site
         process.stderr.write('invoke ' + i + '\n')
@@ -329,7 +331,7 @@ describe('deprecate.function(fn, message)', function () {
   it('should handle rapid calling of deprecated thing', function () {
     this.timeout(5000)
 
-    function callold() {
+    function callold () {
       for (var i = 0; i < 10000; i++) {
         mylib.oldfn()
       }
@@ -340,8 +342,8 @@ describe('deprecate.function(fn, message)', function () {
   })
 
   it('should warn for different calls on same line', function () {
-    function callold() {
-      mylib.oldfn(), mylib.oldfn()
+    function callold () {
+      mylib.oldfn(); mylib.oldfn()
     }
 
     var stderr = captureStderr(callold)
@@ -353,40 +355,40 @@ describe('deprecate.function(fn, message)', function () {
 
   describe('when message omitted', function () {
     it('should generate message for method call on named function', function () {
-      function callold() { mylib.oldfnauto() }
+      function callold () { mylib.oldfnauto() }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
       assert.ok(stderr.indexOf(' fn ') !== -1)
-      assert.ok(/ at [^:]+test\.js:/.test(stderr))
+      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
     })
 
     it('should generate message for method call on anonymous function', function () {
-      function callold() { mylib.oldfnautoanon() }
+      function callold () { mylib.oldfnautoanon() }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
-      assert.ok(/ <anonymous@[^:]+my-lib\.js:[0-9]+:[0-9]+> /.test(stderr))
-      assert.ok(/ at [^:]+test\.js:/.test(stderr))
+      assert.ok(/ <anonymous@[^\\/]+[^:]+my\.js:[0-9]+:[0-9]+> /.test(stderr))
+      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
     })
 
     describe('in strict mode library', function () {
       it('should generate message for method call on named function', function () {
-        function callold() { strictlib.oldfnauto() }
+        function callold () { strictlib.oldfnauto() }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
         assert.ok(stderr.indexOf(' fn ') !== -1)
-        assert.ok(/ at [^:]+test\.js:/.test(stderr))
+        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
       })
 
       it('should generate message for method call on anonymous function', function () {
-        function callold() { strictlib.oldfnautoanon() }
+        function callold () { strictlib.oldfnautoanon() }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
-        assert.ok(/ <anonymous@[^:]+strict-lib\.js:[0-9]+:[0-9]+> /.test(stderr))
-        assert.ok(/ at [^:]+test\.js:/.test(stderr))
+        assert.ok(/ <anonymous@[^\\/]+[^:]+strict\.js:[0-9]+:[0-9]+> /.test(stderr))
+        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
       })
     })
   })
@@ -412,7 +414,7 @@ describe('deprecate.property(obj, prop, message)', function () {
   })
 
   it('should log on access to property', function () {
-    function callprop() { mylib.propa }
+    function callprop () { return mylib.propa }
     var stderr = captureStderr(callprop)
     assert.ok(stderr.indexOf(' deprecated ') !== -1)
     assert.ok(stderr.indexOf(' propa gone ') !== -1)
@@ -420,8 +422,8 @@ describe('deprecate.property(obj, prop, message)', function () {
 
   it('should log on setting property', function () {
     var val
-    function callprop() { val = mylib.propa }
-    function setprop() { mylib.propa = 'newval' }
+    function callprop () { val = mylib.propa }
+    function setprop () { mylib.propa = 'newval' }
     var stderr = captureStderr(setprop)
     assert.ok(stderr.indexOf(' deprecated ') !== -1)
     assert.ok(stderr.indexOf(' propa gone ') !== -1)
@@ -430,9 +432,9 @@ describe('deprecate.property(obj, prop, message)', function () {
   })
 
   it('should only warn once per call site', function () {
-    function callold() {
+    function callold () {
       for (var i = 0; i < 5; i++) {
-        mylib.propa // single call site
+        var v = mylib.propa || v // single call site
         process.stderr.write('access ' + i + '\n')
       }
     }
@@ -443,8 +445,8 @@ describe('deprecate.property(obj, prop, message)', function () {
   })
 
   it('should warn for different accesses on same line', function () {
-    function callold() {
-      mylib.propa, mylib.propa
+    function callold () {
+      mylib.old(); mylib.old()
     }
 
     var stderr = captureStderr(callold)
@@ -455,14 +457,14 @@ describe('deprecate.property(obj, prop, message)', function () {
   })
 
   it('should show call site outside scope', function () {
-    function callold() { mylib.layerprop() }
+    function callold () { mylib.layerprop() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(' propa ') !== -1)
     assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
   })
 
   it('should show call site outside scope from strict lib', function () {
-    function callold() { strictlib.layerprop() }
+    function callold () { strictlib.layerprop() }
     var stderr = captureStderr(callold)
     assert.ok(stderr.indexOf(' propa ') !== -1)
     assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
@@ -470,14 +472,14 @@ describe('deprecate.property(obj, prop, message)', function () {
 
   describe('when obj is a function', function () {
     it('should log on access to property on function', function () {
-      function callprop() { mylib.fnprop.propa }
+      function callprop () { return mylib.fnprop.propa }
       var stderr = captureStderr(callprop)
       assert.ok(stderr.indexOf(' deprecated ') !== -1)
       assert.ok(stderr.indexOf(' fn propa gone ') !== -1)
     })
 
     it('should generate message on named function', function () {
-      function callprop() { mylib.fnprop.propautomsg }
+      function callprop () { return mylib.fnprop.propautomsg }
       var stderr = captureStderr(callprop)
       assert.ok(stderr.indexOf(' deprecated ') !== -1)
       assert.ok(stderr.indexOf(' thefn.propautomsg ') !== -1)
@@ -485,14 +487,14 @@ describe('deprecate.property(obj, prop, message)', function () {
 
     describe('in strict mode library', function () {
       it('should log on access to property on function', function () {
-        function callprop() { strictlib.fnprop.propa }
+        function callprop () { return strictlib.fnprop.propa }
         var stderr = captureStderr(callprop)
         assert.ok(stderr.indexOf(' deprecated ') !== -1)
         assert.ok(stderr.indexOf(' fn propa gone ') !== -1)
       })
 
       it('should generate message on named function', function () {
-        function callprop() { strictlib.fnprop.propautomsg }
+        function callprop () { return strictlib.fnprop.propautomsg }
         var stderr = captureStderr(callprop)
         assert.ok(stderr.indexOf(' deprecated ') !== -1)
         assert.ok(stderr.indexOf(' thefn.propautomsg ') !== -1)
@@ -502,15 +504,15 @@ describe('deprecate.property(obj, prop, message)', function () {
 
   describe('when value descriptor', function () {
     it('should log on access and set', function () {
-      function callold() { mylib.propa }
-      function setold() { mylib.propa = 'val' }
+      function callold () { return mylib.propa }
+      function setold () { mylib.propa = 'val' }
       assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
       assert.ok(captureStderr(setold).indexOf(' deprecated ') !== -1)
     })
 
     it('should not log on set to non-writable', function () {
-      function callold() { mylib.propget }
-      function setold() { mylib.propget = 'val' }
+      function callold () { return mylib.propget }
+      function setold () { mylib.propget = 'val' }
       assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
       assert.equal(captureStderr(setold), '')
     })
@@ -518,41 +520,41 @@ describe('deprecate.property(obj, prop, message)', function () {
 
   describe('when accessor descriptor', function () {
     it('should log on access and set', function () {
-      function callold() { mylib.propdyn }
-      function setold() { mylib.propdyn = 'val' }
+      function callold () { return mylib.propdyn }
+      function setold () { mylib.propdyn = 'val' }
       assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
       assert.ok(captureStderr(setold).indexOf(' deprecated ') !== -1)
     })
 
     it('should not log on access when no accessor', function () {
-      function callold() { mylib.propsetter }
+      function callold () { return mylib.propsetter }
       assert.equal(captureStderr(callold), '')
     })
 
     it('should not log on set when no setter', function () {
-      function callold() { mylib.propgetter = 'val' }
+      function callold () { mylib.propgetter = 'val' }
       assert.equal(captureStderr(callold), '')
     })
   })
 
   describe('when message omitted', function () {
     it('should generate message for method call on named function', function () {
-      function callold() { mylib.propauto }
+      function callold () { return mylib.propauto }
       var stderr = captureStderr(callold)
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
       assert.ok(stderr.indexOf('deprecated') !== -1)
       assert.ok(stderr.indexOf(' propauto ') !== -1)
-      assert.ok(/ at [^:]+test\.js:/.test(stderr))
+      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
     })
 
     describe('in strict mode library', function () {
       it('should generate message for method call on named function', function () {
-        function callold() { strictlib.propauto }
+        function callold () { return strictlib.propauto }
         var stderr = captureStderr(callold)
         assert.ok(stderr.indexOf(basename(__filename)) !== -1)
         assert.ok(stderr.indexOf('deprecated') !== -1)
         assert.ok(stderr.indexOf(' propauto ') !== -1)
-        assert.ok(/ at [^:]+test\.js:/.test(stderr))
+        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
       })
     })
   })
@@ -563,14 +565,14 @@ describe('process.on(\'deprecation\', fn)', function () {
   var stderr
   before(function () {
     process.on('deprecation', ondeprecation)
-    function callold() { mylib.old() }
+    function callold () { mylib.old() }
     stderr = captureStderr(callold)
   })
   after(function () {
     process.removeListener('deprecation', ondeprecation)
   })
 
-  function ondeprecation(err) { error = err }
+  function ondeprecation (err) { error = err }
 
   it('should not write when listener exists', function () {
     assert.equal(stderr, '')
@@ -603,7 +605,7 @@ describe('process.on(\'deprecation\', fn)', function () {
   it('should emit error with proper stack', function () {
     var stack = error.stack.split('\n')
     assert.equal(stack[0], 'DeprecationError: my-lib deprecated old')
-    assert.ok(/    at callold \(.+test\.js:[0-9]+:[0-9]+\)/.test(stack[1]))
+    assert.ok(/ {4}at callold \(.+test\.js:[0-9]+:[0-9]+\)/.test(stack[1]))
   })
 
   it('should have writable properties', function () {
@@ -618,7 +620,7 @@ describe('process.on(\'deprecation\', fn)', function () {
 
 describe('process.env.NO_DEPRECATION', function () {
   var error
-  function ondeprecation(err) { error = err }
+  function ondeprecation (err) { error = err }
 
   beforeEach(function () {
     error = null
@@ -634,27 +636,27 @@ describe('process.env.NO_DEPRECATION', function () {
 
   it('should suppress given namespace', function () {
     process.env.NO_DEPRECATION = 'old-lib'
-    var oldlib = require('./fixtures/old-lib')
+    var oldlib = libs.old
     assert.equal(captureStderr(oldlib.old), '')
     assert.notEqual(captureStderr(oldlib.old2), '')
   })
 
   it('should suppress multiple namespaces', function () {
     process.env.NO_DEPRECATION = 'cool-lib,neat-lib'
-    var coollib = require('./fixtures/cool-lib')
+    var coollib = libs.cool
     assert.equal(captureStderr(coollib.cool), '')
     assert.equal(captureStderr(coollib.neat), '')
   })
 
   it('should be case-insensitive', function () {
     process.env.NO_DEPRECATION = 'NEW-LIB'
-    var newlib = require('./fixtures/new-lib')
+    var newlib = libs.new
     assert.equal(captureStderr(newlib.old), '')
   })
 
   it('should emit "deprecation" events anyway', function () {
     process.env.NO_DEPRECATION = 'thing-lib'
-    var thinglib = require('./fixtures/thing-lib')
+    var thinglib = libs.thing
     process.on('deprecation', ondeprecation)
     assert.equal(captureStderr(thinglib.old), '')
     assert.equal(error.namespace, 'thing-lib')
@@ -663,7 +665,7 @@ describe('process.env.NO_DEPRECATION', function () {
   describe('when *', function () {
     it('should suppress any namespace', function () {
       process.env.NO_DEPRECATION = '*'
-      var multilib = require('./fixtures/multi-lib')
+      var multilib = libs.multi
       assert.equal(captureStderr(multilib.old), '')
       assert.equal(captureStderr(multilib.old2), '')
     })
@@ -680,22 +682,22 @@ describe('process.env.TRACE_DEPRECATION', function () {
   })
 
   it('should trace given namespace', function () {
-    var tracelib = require('./fixtures/trace-lib')
-    function callold() { tracelib.old() }
+    var tracelib = libs.trace
+    function callold () { tracelib.old() }
     assert.ok(captureStderr(callold).indexOf(' trace-lib deprecated old\n    at callold (') !== -1)
   })
 
   it('should not trace non-given namespace', function () {
-    var tracelib = require('./fixtures/trace-lib')
-    function callold() { tracelib.old2() }
+    var tracelib = libs.trace
+    function callold () { tracelib.old2() }
     assert.ok(captureStderr(callold).indexOf(' trace-lib-other deprecated old2 at ') !== -1)
   })
 
   describe('when output supports colors', function () {
     var stderr
     before(function () {
-      var tracelib = require('./fixtures/trace-lib')
-      function callold() { tracelib.old() }
+      var tracelib = libs.trace
+      function callold () { tracelib.old() }
       stderr = captureStderr(callold, true)
     })
 
@@ -710,7 +712,7 @@ describe('process.env.TRACE_DEPRECATION', function () {
 
     it('should log call site in color', function () {
       assert.ok(stderr.indexOf(basename(__filename)) !== -1)
-      assert.ok(/\x1b\[\d+mat callold \(/.test(stderr))
+      assert.ok(/\x1b\[\d+mat callold \(/.test(stderr)) // eslint-disable-line no-control-regex
     })
   })
 })
@@ -756,16 +758,16 @@ describe('node script.js', function () {
   })
 }())
 
-function captureChildStderr(args, callback) {
+function captureChildStderr (args, callback) {
   var chunks = []
   var env = {PATH: process.env.PATH}
-  var exec = process.argv[0]
+  var exec = process.execPath
   var proc = spawn(exec, args, {
     env: env
   })
 
   proc.stdout.resume()
-  proc.stderr.on('data', function ondata(chunk) {
+  proc.stderr.on('data', function ondata (chunk) {
     chunks.push(chunk)
   })
 
@@ -775,23 +777,3 @@ function captureChildStderr(args, callback) {
     callback(null, stderr)
   })
 }
-
-function captureStderr(fn, color) {
-  var chunks = []
-  var isTTY = process.stderr.isTTY
-  var write = process.stderr.write
-
-  process.stderr.isTTY = Boolean(color)
-  process.stderr.write = function write(chunk, encoding) {
-    chunks.push(new Buffer(chunk, encoding))
-  }
-
-  try {
-    fn()
-  } finally {
-    process.stderr.isTTY = isTTY
-    process.stderr.write = write
-  }
-
-  return bufferConcat(chunks).toString('utf8')
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-depd.git



More information about the Pkg-javascript-commits mailing list