diff --git a/tailscalectl/lib.js b/tailscalectl/lib.js index 6e949f5..74a5bc6 100644 --- a/tailscalectl/lib.js +++ b/tailscalectl/lib.js @@ -15,4 +15,7 @@ function makeExitNodeCommand(hostname) { return ["tailscale", "set", "--exit-node=" + hostname] } -export { parsePeers, makeExitNodeCommand } +// CommonJS export for Node.js tests (ignored by QML) +if (typeof module !== "undefined" && module.exports) { + module.exports = { parsePeers, makeExitNodeCommand } +} diff --git a/test/lib.test.js b/test/lib.test.js index 06bbbf9..ace694c 100644 --- a/test/lib.test.js +++ b/test/lib.test.js @@ -1,6 +1,7 @@ import { test } from "node:test" import assert from "node:assert" -import { parsePeers, makeExitNodeCommand } from "../tailscalectl/lib.js" +import lib from "../tailscalectl/lib.js" +const { parsePeers, makeExitNodeCommand } = lib test("parsePeers extracts exitNode from ExitNodeOption", () => { const peerMap = {