From 37b65751e2d68ca45c1af749ea4b6fa0650c1cc1 Mon Sep 17 00:00:00 2001 From: Mayur Kale <mayurkale@google.com> Date: Thu, 1 Aug 2019 09:58:15 -0700 Subject: [PATCH] fix: remove test functions out of the class --- .../src/instrumentation/PluginLoader.ts | 14 +++++++------- .../test/instrumentation/PluginLoader.test.ts | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/opentelemetry-node-tracer/src/instrumentation/PluginLoader.ts b/packages/opentelemetry-node-tracer/src/instrumentation/PluginLoader.ts index a95a6c76493..33993cc4a96 100644 --- a/packages/opentelemetry-node-tracer/src/instrumentation/PluginLoader.ts +++ b/packages/opentelemetry-node-tracer/src/instrumentation/PluginLoader.ts @@ -138,12 +138,12 @@ export class PluginLoader { } return this; } +} - /** - * Adds a search path for plugin modules. Intended for testing purposes only. - * @param searchPath The path to add. - */ - static set searchPathForTest(searchPath: string) { - module.paths.push(searchPath); - } +/** + * Adds a search path for plugin modules. Intended for testing purposes only. + * @param searchPath The path to add. + */ +export function searchPathForTest(searchPath: string) { + module.paths.push(searchPath); } diff --git a/packages/opentelemetry-node-tracer/test/instrumentation/PluginLoader.test.ts b/packages/opentelemetry-node-tracer/test/instrumentation/PluginLoader.test.ts index 9e7e36a3f6a..132aaab7eb7 100644 --- a/packages/opentelemetry-node-tracer/test/instrumentation/PluginLoader.test.ts +++ b/packages/opentelemetry-node-tracer/test/instrumentation/PluginLoader.test.ts @@ -20,6 +20,7 @@ import * as path from 'path'; import { HookState, PluginLoader, + searchPathForTest, } from '../../src/instrumentation/PluginLoader'; const INSTALLED_PLUGINS_PATH = path.join(__dirname, 'node_modules'); @@ -31,7 +32,7 @@ describe('PluginLoader', () => { before(() => { module.paths.push(INSTALLED_PLUGINS_PATH); - PluginLoader.searchPathForTest = INSTALLED_PLUGINS_PATH; + searchPathForTest(INSTALLED_PLUGINS_PATH); }); afterEach(() => {