2020-10-30 10:18:59 +03:00
|
|
|
import { logger } from "@coder/logger"
|
|
|
|
import * as assert from "assert"
|
2020-10-30 10:26:30 +03:00
|
|
|
import { describe } from "mocha"
|
|
|
|
import * as path from "path"
|
|
|
|
import { PluginAPI } from "../src/node/plugin"
|
2020-10-30 10:18:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use $LOG_LEVEL=debug to see debug logs.
|
|
|
|
*/
|
|
|
|
describe("plugin", () => {
|
|
|
|
it("loads", async () => {
|
|
|
|
const papi = new PluginAPI(logger, path.resolve(__dirname, "test-plugin") + ":meow")
|
|
|
|
await papi.loadPlugins()
|
|
|
|
|
|
|
|
// We remove the function fields from the application's plugins.
|
|
|
|
const apps = JSON.parse(JSON.stringify(await papi.applications()))
|
|
|
|
|
2020-10-30 10:26:30 +03:00
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name: "goland",
|
|
|
|
version: "4.0.0",
|
2020-10-30 10:39:14 +03:00
|
|
|
iconPath: "/icon.svg",
|
2020-10-30 10:26:30 +03:00
|
|
|
plugin: {
|
|
|
|
name: "test-plugin",
|
|
|
|
version: "1.0.0",
|
|
|
|
description: "Fake plugin for testing code-server's plugin API",
|
2020-10-30 10:37:42 +03:00
|
|
|
modulePath: path.join(__dirname, "test-plugin"),
|
2020-10-30 10:26:30 +03:00
|
|
|
},
|
2020-10-30 10:18:59 +03:00
|
|
|
},
|
2020-10-30 10:26:30 +03:00
|
|
|
],
|
|
|
|
apps,
|
|
|
|
)
|
2020-10-30 10:18:59 +03:00
|
|
|
})
|
|
|
|
})
|