Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: debug-js/debug
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 68b4dc8d8549d3924673c38fccc5d594f0a38da1
Choose a base ref
...
head repository: debug-js/debug
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80ef62a3af4df95250d77d64edfc3d0e1667e7e8
Choose a head ref

Commits on Oct 8, 2018

  1. debug: Replaced phantomJS by chrome

    Added script in package.json for running Test-suite
    
    Signed-off-by: ossdev07 <ossdev@puresoftware.com>
    ossdev07 authored and Qix- committed Oct 8, 2018
    Copy the full SHA
    615cbb9 View commit details
  2. Update karma.conf.js

    ossdev07 authored and Qix- committed Oct 8, 2018
    Copy the full SHA
    4fe746a View commit details
  3. Update karma.conf.js

    ossdev07 authored and Qix- committed Oct 8, 2018
    Copy the full SHA
    61c9484 View commit details
  4. Update karma.conf.js

    ossdev07 authored and Qix- committed Oct 8, 2018
    Copy the full SHA
    7ea4076 View commit details

Commits on Oct 10, 2018

  1. Copy the full SHA
    dab648a View commit details

Commits on Oct 11, 2018

  1. deprecate CHANGELOG.md

    Qix- committed Oct 11, 2018
    Copy the full SHA
    5fadf45 View commit details

Commits on Dec 19, 2018

  1. remove changelog

    Qix- committed Dec 19, 2018
    Copy the full SHA
    010fd0d View commit details
  2. remove bower.json (closes #602)

    Qix- committed Dec 19, 2018
    Copy the full SHA
    dfd5ffa View commit details
  3. remove .eslintrc

    Qix- committed Dec 19, 2018
    Copy the full SHA
    dc5c34f View commit details
  4. remove .coveralls.yml

    Qix- committed Dec 19, 2018
    Copy the full SHA
    fe49015 View commit details
  5. add Josh Junon to contributors

    Qix- committed Dec 19, 2018
    Copy the full SHA
    ad551e2 View commit details
  6. update development dependencies

    Qix- committed Dec 19, 2018
    Copy the full SHA
    0e94034 View commit details
  7. remove build system (closes #652)

    Qix- committed Dec 19, 2018
    1
    Copy the full SHA
    94583b6 View commit details
  8. Copy the full SHA
    c0127b1 View commit details
  9. use console.debug() in browser when available (closes #600)

    also removes a branch for each logging call, slightly improving
    performance in the browser.
    Qix- committed Dec 19, 2018
    Copy the full SHA
    5528572 View commit details
  10. Copy the full SHA
    825d35a View commit details

Commits on Dec 22, 2018

  1. test: only run coveralls on travis

    s/posttest:node/coverage
    
    Explicitly call coverage only from CI. This will stop the test suite
    from failing on a system not configured to authenticate with
    circle-ci
    MylesBorins authored and Qix- committed Dec 22, 2018
    Copy the full SHA
    982c12c View commit details

Commits on Jan 10, 2019

  1. Copy the full SHA
    976f8d2 View commit details
  2. fix links in issue templates

    Qix- committed Jan 10, 2019
    7
    Copy the full SHA
    5c7c61d View commit details

Commits on Nov 13, 2019

  1. Update ISSUE_TEMPLATE.md

    Qix- authored Nov 13, 2019
    9
    Copy the full SHA
    608fca9 View commit details

Commits on Jan 8, 2020

  1. Add "engines" to package.json (#680)

    vkarpov15 authored and TooTallNate committed Jan 8, 2020
    Copy the full SHA
    3f4d724 View commit details

Commits on Jan 12, 2020

  1. run linter inside of test script

    Qix- committed Jan 12, 2020
    Copy the full SHA
    4acdeed View commit details
  2. 2
    Copy the full SHA
    0c1d518 View commit details

Commits on Feb 23, 2020

  1. Copy the full SHA
    6b07f9e View commit details

Commits on Mar 27, 2020

  1. Update and pin ms to 2.1.2

    dougwilson authored and Qix- committed Mar 27, 2020
    Copy the full SHA
    db306db View commit details

Commits on May 19, 2020

  1. Copy the full SHA
    09914af View commit details
  2. 4.2.0

    Qix- committed May 19, 2020
    Copy the full SHA
    80ef62a View commit details
Showing with 129 additions and 659 deletions.
  1. +0 −13 .babelrc
  2. +0 −1 .coveralls.yml
  3. +0 −14 .eslintrc
  4. +28 −0 .github/ISSUE_TEMPLATE.md
  5. +17 −0 .github/PULL_REQUEST_TEMPLATE.md
  6. +2 −0 .travis.yml
  7. +0 −395 CHANGELOG.md
  8. +0 −29 bower.json
  9. +0 −28 examples/browser/colors.html
  10. +0 −20 examples/node/app.js
  11. +0 −8 examples/node/colors.js
  12. +0 −18 examples/node/stdout.js
  13. +0 −10 examples/node/wildcards.js
  14. +0 −27 examples/node/worker.js
  15. +24 −27 karma.conf.js
  16. +19 −23 package.json
  17. +5 −10 src/browser.js
  18. +5 −5 src/common.js
  19. +29 −31 test.js
13 changes: 0 additions & 13 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
DO NOT SUBMIT ISSUES ASKING TO REMOVE ES6.
IT WILL BE CLOSED.
IT WILL BE LOCKED.
We use ES2015+ for a reason. Modern best
practices dictate the use of tooling like
Babel and @babel/preset-env in order to
target the browsers that make sense for
your project.
For more information, please see:
https://github.com/sindresorhus/ama/issues/446#issuecomment-281014491
Please keep in mind that `debug` is downloaded,
installed, transpiled and used millions of times
*per day*. If you have an error with `debug`, it's
most likely your own configuration (e.g. with Babel,
Webpack, etc).
Unless you post ample evidence you have tried
to fix this yourself, it will most likely
be determined that your issue is localized
to your project - not `debug`.
-->
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
DO NOT SUBMIT PULL REQUESTS REMOVING ES6.
IT WILL BE CLOSED.
IT WILL NOT BE MERGED.
We use ES2015+ for a reason. Modern best
practices dictate the use of tooling like
Babel and @babel/preset-env in order to
target the browsers that make sense for
your project.
For more information, please see:
https://github.com/sindresorhus/ama/issues/446#issuecomment-281014491
-->
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -6,10 +6,12 @@ node_js:
- "6"
- "8"
- "10"
- "11"

install:
- npm install

script:
- npm run lint
- npm test
- npm run test:coverage
395 changes: 0 additions & 395 deletions CHANGELOG.md

This file was deleted.

29 changes: 0 additions & 29 deletions bower.json

This file was deleted.

28 changes: 0 additions & 28 deletions examples/browser/colors.html

This file was deleted.

20 changes: 0 additions & 20 deletions examples/node/app.js

This file was deleted.

8 changes: 0 additions & 8 deletions examples/node/colors.js

This file was deleted.

18 changes: 0 additions & 18 deletions examples/node/stdout.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/node/wildcards.js

This file was deleted.

27 changes: 0 additions & 27 deletions examples/node/worker.js

This file was deleted.

51 changes: 24 additions & 27 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
// Karma configuration
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)

module.exports = function (config) {
config.set({

// Base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// Frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
frameworks: ['browserify', 'mocha'],

// List of files / patterns to load in the browser
files: [
'dist/debug.js',
'dist/test.js'
],

// List of files to exclude
exclude: [
'src/node.js'
'src/browser.js',
'src/common.js',
'test.js'
],

// Preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},

// Test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
@@ -40,21 +24,34 @@ module.exports = function (config) {

// Level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// Enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
logLevel: config.LOG_DEBUG,

// Start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
browsers: ['HeadlessChrome'],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},

preprocessors: {
// *Sigh* what a glob, folks!
'{{!(node_modules),*.js},!(node_modules)/**/*.js}': ['browserify']
},

browserify: {
debug: true,
transform: ['brfs']
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
concurrency: 1
});
};
42 changes: 19 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "debug",
"version": "4.1.0",
"version": "4.2.0",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"
@@ -13,51 +13,47 @@
],
"files": [
"src",
"dist/debug.js",
"LICENSE",
"README.md"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
"Andrew Rhyne <rhyneandrew@gmail.com>"
"Andrew Rhyne <rhyneandrew@gmail.com>",
"Josh Junon <josh@junon.me>"
],
"license": "MIT",
"scripts": {
"lint": "xo",
"test": "npm run test:node && npm run test:browser",
"test": "npm run test:node && npm run test:browser && npm run lint",
"test:node": "istanbul cover _mocha -- test.js",
"posttest:node": "cat ./coverage/lcov.info | coveralls",
"pretest:browser": "npm run build",
"test:browser": "karma start --single-run",
"prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .",
"build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js",
"build:test": "babel -d dist test.js",
"build": "npm run build:debug && npm run build:test",
"clean": "rimraf dist coverage"
"test:coverage": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"ms": "^2.1.1"
"ms": "2.1.2"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"browserify": "14.4.0",
"chai": "^3.5.0",
"concurrently": "^3.1.0",
"brfs": "^2.0.1",
"browserify": "^16.2.3",
"coveralls": "^3.0.2",
"istanbul": "^0.4.5",
"karma": "^3.0.0",
"karma-chai": "^0.1.0",
"karma": "^3.1.4",
"karma-browserify": "^6.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.2.0",
"rimraf": "^2.5.4",
"xo": "^0.23.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
},
"main": "./src/index.js",
"browser": "./src/browser.js",
"unpkg": "./dist/debug.js"
"engines": {
"node": ">=6.0"
}
}
15 changes: 5 additions & 10 deletions src/browser.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
* This is the web browser implementation of `debug()`.
*/

exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
@@ -170,18 +169,14 @@ function formatArgs(args) {
}

/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
* Invokes `console.debug()` when available.
* No-op when `console.debug` is not a "function".
* If `console.debug` is not available, falls back
* to `console.log`.
*
* @api public
*/
function log(...args) {
// This hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return typeof console === 'object' &&
console.log &&
console.log(...args);
}
exports.log = console.debug || console.log || (() => {});

/**
* Save `namespaces`.
10 changes: 5 additions & 5 deletions src/common.js
Original file line number Diff line number Diff line change
@@ -117,13 +117,11 @@ function setup(env) {
debug.namespace = namespace;
debug.enabled = createDebug.enabled(namespace);
debug.useColors = createDebug.useColors();
debug.color = selectColor(namespace);
debug.color = createDebug.selectColor(namespace);
debug.destroy = destroy;
debug.extend = extend;
// Debug.formatArgs = formatArgs;
// debug.rawLog = rawLog;

// env-specific initialization logic for debug instances
// Env-specific initialization logic for debug instances
if (typeof createDebug.init === 'function') {
createDebug.init(debug);
}
@@ -143,7 +141,9 @@ function setup(env) {
}

function extend(namespace, delimiter) {
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}

/**
60 changes: 29 additions & 31 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
/* eslint-env mocha */
'use strict';

let chai;

let expect;

let debug;

if (typeof module !== 'undefined') {
chai = require('chai');
expect = chai.expect;
debug = require('./src');
}
const assert = require('assert');
const debug = require('./src');

describe('debug', () => {
it('passes a basic sanity check', () => {
const log = debug('test');
log.enabled = true;
log.log = () => {};

expect(() => log('hello world')).to.not.throw();
assert.doesNotThrow(() => log('hello world'));
});

it('allows namespaces to be a non-string value', () => {
const log = debug('test');
log.enabled = true;
log.log = () => {};

expect(() => debug.enable(true)).to.not.throw();
assert.doesNotThrow(() => debug.enable(true));
});

it('honors global debug namespace enable calls', () => {
expect(debug('test:12345').enabled).to.equal(false);
expect(debug('test:67890').enabled).to.equal(false);
assert.deepStrictEqual(debug('test:12345').enabled, false);
assert.deepStrictEqual(debug('test:67890').enabled, false);

debug.enable('test:12345');
expect(debug('test:12345').enabled).to.equal(true);
expect(debug('test:67890').enabled).to.equal(false);
assert.deepStrictEqual(debug('test:12345').enabled, true);
assert.deepStrictEqual(debug('test:67890').enabled, false);
});

it('uses custom log function', () => {
@@ -50,7 +40,7 @@ describe('debug', () => {
log('using custom log function again');
log('%O', 12345);

expect(messages.length).to.equal(3);
assert.deepStrictEqual(messages.length, 3);
});

describe('extend namespace', () => {
@@ -60,7 +50,7 @@ describe('debug', () => {
log.log = () => {};

const logBar = log.extend('bar');
expect(logBar.namespace).to.be.equal('foo:bar');
assert.deepStrictEqual(logBar.namespace, 'foo:bar');
});

it('should extend namespace with custom delimiter', () => {
@@ -69,7 +59,7 @@ describe('debug', () => {
log.log = () => {};

const logBar = log.extend('bar', '--');
expect(logBar.namespace).to.be.equal('foo--bar');
assert.deepStrictEqual(logBar.namespace, 'foo--bar');
});

it('should extend namespace with empty delimiter', () => {
@@ -78,46 +68,54 @@ describe('debug', () => {
log.log = () => {};

const logBar = log.extend('bar', '');
expect(logBar.namespace).to.be.equal('foobar');
assert.deepStrictEqual(logBar.namespace, 'foobar');
});

it('should keep the log function between extensions', () => {
const log = debug('foo');
log.log = () => {};

const logBar = log.extend('bar');
assert.deepStrictEqual(log.log, logBar.log);
});
});

describe('rebuild namespaces string (disable)', () => {
it('handle names, skips, and wildcards', () => {
debug.enable('test,abc*,-abc');
const namespaces = debug.disable();
expect(namespaces).to.equal('test,abc*,-abc');
assert.deepStrictEqual(namespaces, 'test,abc*,-abc');
});

it('handles empty', () => {
debug.enable('');
const namespaces = debug.disable();
expect(namespaces).to.equal('');
expect(debug.names).to.deep.equal([]);
expect(debug.skips).to.deep.equal([]);
assert.deepStrictEqual(namespaces, '');
assert.deepStrictEqual(debug.names, []);
assert.deepStrictEqual(debug.skips, []);
});

it('handles all', () => {
debug.enable('*');
const namespaces = debug.disable();
expect(namespaces).to.equal('*');
assert.deepStrictEqual(namespaces, '*');
});

it('handles skip all', () => {
debug.enable('-*');
const namespaces = debug.disable();
expect(namespaces).to.equal('-*');
assert.deepStrictEqual(namespaces, '-*');
});

it('names+skips same with new string', () => {
debug.enable('test,abc*,-abc');
const oldNames = [...debug.names];
const oldSkips = [...debug.skips];
const namespaces = debug.disable();
expect(namespaces).to.equal('test,abc*,-abc');
assert.deepStrictEqual(namespaces, 'test,abc*,-abc');
debug.enable(namespaces);
expect(oldNames.map(String)).to.deep.equal(debug.names.map(String));
expect(oldSkips.map(String)).to.deep.equal(debug.skips.map(String));
assert.deepStrictEqual(oldNames.map(String), debug.names.map(String));
assert.deepStrictEqual(oldSkips.map(String), debug.skips.map(String));
});
});
});