File size: 940 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";

type PackageManifest = {
  dependencies?: Record<string, string>;
};

function readJson<T>(relativePath: string): T {
  const absolutePath = path.resolve(process.cwd(), relativePath);
  return JSON.parse(fs.readFileSync(absolutePath, "utf8")) as T;
}

describe("bundled plugin runtime dependencies", () => {
  it("keeps bundled Feishu runtime deps available from the published root package", () => {
    const rootManifest = readJson<PackageManifest>("package.json");
    const feishuManifest = readJson<PackageManifest>("extensions/feishu/package.json");
    const feishuSpec = feishuManifest.dependencies?.["@larksuiteoapi/node-sdk"];
    const rootSpec = rootManifest.dependencies?.["@larksuiteoapi/node-sdk"];

    expect(feishuSpec).toBeTruthy();
    expect(rootSpec).toBeTruthy();
    expect(rootSpec).toBe(feishuSpec);
  });
});