-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const helper = require('../../lib/agent_helper') | ||
const agent = helper.instrumentMockedAgent({}) | ||
agent.start(() => { | ||
const api = helper.getAgentApi() | ||
|
||
const didWeDoIt = [] | ||
api.instrument('test-logger', (shim, mod) => { | ||
shim.wrap(mod.prototype, 'info', (shim, fn) => { | ||
return function wrappedInfo() { | ||
didWeDoIt.push('yes') | ||
console.log('wrapped info') | ||
console.log(shim.isWrapped(mod.prototype.info)) | ||
return fn.apply(this, arguments) | ||
} | ||
}) | ||
}) | ||
|
||
const { Writable } = require('stream') | ||
const Person = require('./testdata/index') | ||
|
||
const lines = [] | ||
const dest = new Writable({ | ||
write(chunk, _, cb) { | ||
lines.push(chunk.toString()) | ||
cb() | ||
} | ||
}) | ||
const person = new Person(dest) | ||
console.log(person.isHuman) | ||
console.log(lines) | ||
|
||
// This should be true if we have solved the problem correctly. | ||
console.log(didWeDoIt.length === 2) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
// eslint-disable-next-line node/no-extraneous-require | ||
const Person = require('person') | ||
|
||
module.exports = Person |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.