Skip to content

Commit 118507a

Browse files
committed
Load only test plugin during tests
The other plugins in my path were causing the tests to fail.
1 parent ca22d27 commit 118507a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/node/plugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class PluginAPI {
118118
* loadPlugins loads all plugins based on this.csPlugin,
119119
* this.csPluginPath and the built in plugins.
120120
*/
121-
public async loadPlugins(): Promise<void> {
121+
public async loadPlugins(loadBuiltin = true): Promise<void> {
122122
for (const dir of this.csPlugin.split(":")) {
123123
if (!dir) {
124124
continue
@@ -133,8 +133,9 @@ export class PluginAPI {
133133
await this._loadPlugins(dir)
134134
}
135135

136-
// Built-in plugins.
137-
await this._loadPlugins(path.join(__dirname, "../../plugins"))
136+
if (loadBuiltin) {
137+
await this._loadPlugins(path.join(__dirname, "../../plugins"))
138+
}
138139
}
139140

140141
/**

test/plugin.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ describe("plugin", () => {
1717
let s: httpserver.HttpServer
1818

1919
before(async () => {
20-
papi = new PluginAPI(logger, `${path.resolve(__dirname, "test-plugin")}:meow`)
21-
await papi.loadPlugins()
20+
// Only include the test plugin to avoid contaminating results with other
21+
// plugins that might be on the filesystem.
22+
papi = new PluginAPI(logger, `${path.resolve(__dirname, "test-plugin")}:meow`, "")
23+
await papi.loadPlugins(false)
2224

2325
const app = express.default()
2426
papi.mount(app)

0 commit comments

Comments
 (0)