Skip to content

Instantly share code, notes, and snippets.

🔮
the only way out is through

isaacs isaacs

🔮
the only way out is through
Block or report user

Report or block isaacs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lib-arborist-tracker.js
const _progress = Symbol('_progress')
const npmlog = require('npmlog') // to be removed...
const procLog = require('./proc-log.js')
module.exports = cls => class Tracker extends cls {
constructor (options = {}) {
super(options)
this.log = options.log || npmlog || procLog
View gist:70de2395bc36de13b555ab3fb950b6e2
ssh-dss AAAAB3NzaC1kc3MAAACBAJ6M0r6x1VWmMZL4/QUfIpFX8hJb0z4yyxgkWI1TDYnFNd3lgI4l5zGZQgnyeaL14BoBbiEoIfAAlQ9dzAYYiX7M5STvR543eLY08Ft15T7vmufmE2aAKQhCyb8Q1bHk3rUHeE4l+DzRXirs53s53MbrG/iiYFOb3yieYrbUkRMlAAAAFQDnjodne9N5V4kC/9PLOdS7hSwUxwAAAIAK5iA45rDaMeEfBwpV7W8DyBvVqy7SBe4av8n547YnVM/n762r3vRl/KlCqpyrgH13aH5YktDrWpKAmlqo7vVCLF2zfTMWkXUKiYuojc/jEcJpi1ayOE0Sa5eH3dQJ17Ilc2prLVGS95/6bEl4ZQv+PLujaibcQ+YArkRPsL7xkwAAAIAZ/AbmFPNMamPYjBh6UV1glBnTBdUhNH0SmWFgBgngyWFQq6Y/SVFa1MHLHWFapixNE5g9c6IcdXS1W+N2Xmb7AnJum8oseMjs6VxAH5AQQHllTE15JspeotaBZsgKWFXH5s/gNEC9mOqqtbM0BA+tqVKXN24lVGEEmHqqfcFBsg== isaacs@sistertrain-lm
View gist:0b48c7f010bf20614a070d3f91f2a015
diff --git a/lib/test.js b/lib/test.js
index dbd559a..4bc4147 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -1060,6 +1060,35 @@ class Test extends Base {
return this.ok(!obj, message, extra)
}
+ doesNotEmit (emitter, event, message, extra) {
+ this.currentAssert = Test.prototype.doesNotEmit
View throw.js
const t = require('tap')
t.test('throw immediately', t => {
throw new Error('thrown immediately')
})
t.test('throw in nextTick', t => {
process.nextTick(() => {
throw new Error('thrown in next tick')
})
View escape.sh
#!/bin/bash
TEST=$'foo\n\nbar'
printf %q "$TEST"
View prune-dev.js
// usage: put this in your package.json
// "scripts": {
// "prepublishOnly": "node prune-dev.js",
// "postpublish": "git checkout npm-shrinkwrap.json"
// }
const prune = sw => {
if (sw.dependencies) {
for (const [name, dep] of Object.entries(sw.dependencies)) {
if (dep.dev)
delete sw.dependencies[name]
View gist:be6f48bea57fe33a62d4ffd6f0bfcda4
diff --git a/agent.js b/agent.js
index 12ea1ea..81dbdff 100644
--- a/agent.js
+++ b/agent.js
@@ -142,7 +142,9 @@ function getProxyUri (uri, opts) {
}
const getAuth = u =>
- u.username && u.password ? `${u.username}:${u.password}` : null
+ u.username && u.password ? `${u.username}:${u.password}`
View gist:7c34832e7bc6d003d7980e2a2a99a4c6
const Domain = require('../..')
const create = name => Object.assign(new Domain(onerror(name)), {name})
const onerror = name => (er, type) => console.error(`${name} ${type}:`, er)
const d1 = create(1)
Promise.reject('expect 1 - Promise.reject')
const d2 = create(2)
Promise.resolve().then(() => {
throw 'expect 2 - Promise.resolve(throw)'
View long-buffer.js
const {format} = require('./')
const str = ('asdf "quote" '.repeat(5) + '\n').repeat(10) +
('foo'.repeat(5) + '\n').repeat(5) +
('asdf'.repeat(10) + '\n').repeat(5)
const allBytes = Buffer.alloc(0x100)
for (let i = 0; i < 0x100; i++) {
allBytes[i] = i
}
console.log(format({
long: Buffer.from(str),
View long-buffer.js
const {format} = require('./')
const str = ('asdf "quote" '.repeat(5) + '\n').repeat(10) +
('foo'.repeat(5) + '\n').repeat(5) +
('asdf'.repeat(10) + '\n').repeat(5)
const allBytes = Buffer.alloc(0x100)
for (let i = 0; i < 0x100; i++) {
allBytes[i] = i
}
console.log(format({
long: Buffer.from(str),
You can’t perform that action at this time.