Skip to content

Commit

Permalink
fix: drop warning message for non-patched modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed Mar 20, 2018
1 parent fa33f25 commit 6f73473
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/trace-plugin-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ export class ModulePluginWrapper implements PluginWrapper {
} else if (instrumentation.intercept) {
exportedValue = instrumentation.intercept(
exportedValue, this.createTraceAgentInstance(file));
} else {
this.logger.warn(`PluginWrapper#applyPlugin: [${
logString}] Patch object has no known functions for patching this file.`);
}
return exportedValue;
}, moduleExports as T);
Expand Down
5 changes: 3 additions & 2 deletions test/test-plugin-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,14 @@ describe('Trace Plugin Loader', () => {

it('warns when a module is patched by a non-conformant plugin', () => {
makePluginLoader({plugins: {'[core]': 'plugin-core'}}).activate();
// Reasons for warnings issued are listed as comments.
// Reasons for possible warnings issued are listed as comments.
require('crypto'); // neither patch nor intercept
require('os'); // both patch and intercept
require('dns'); // two Patch objects for a single file
// Do not warn when there is no patch/intercept function.
assert.strictEqual(
logger.getNumLogsWith('warn', `[[core]@${PROCESS_VERSION}:crypto]`),
1);
0);
assert.strictEqual(
logger.getNumLogsWith('warn', `[[core]@${PROCESS_VERSION}:os]`), 1);
assert.strictEqual(
Expand Down

0 comments on commit 6f73473

Please sign in to comment.