Skip to content

Commit fb37473

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

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
@@ -15,8 +15,10 @@ describe("plugin", () => {
1515
let s: httpserver.HttpServer
1616

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

2123
const app = express.default()
2224
papi.mount(app)

0 commit comments

Comments
 (0)