CI / Client installer (macos-latest) (push) Canceled after 0s
CI / Client installer (ubuntu-latest) (push) Canceled after 0s
CI / Client installer (windows-latest) (push) Canceled after 0s
CI / test (22) (push) Canceled after 0s
CI / test (24) (push) Canceled after 0s
CI / release-smoke (push) Canceled after 0s
21 lines
967 B
TypeScript
21 lines
967 B
TypeScript
import assert from "node:assert/strict";
|
|
import { mkdirSync, mkdtempSync, symlinkSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join, resolve } from "node:path";
|
|
import test from "node:test";
|
|
import { pathToFileURL } from "node:url";
|
|
import { isDirectEntrypoint } from "../src/entrypoint.js";
|
|
|
|
test("packaged CLI entrypoint recognizes an npm-style symlink", () => {
|
|
const root = mkdtempSync(join(tmpdir(), "ding-entrypoint-"));
|
|
const target = join(root, "dist", "bridge.js");
|
|
const bin = join(root, "dingtalk-approval-bridge");
|
|
mkdirSync(join(root, "dist"));
|
|
writeFileSync(target, "", { flag: "w" });
|
|
symlinkSync(target, bin);
|
|
assert.equal(isDirectEntrypoint(pathToFileURL(target).href, bin), true);
|
|
assert.equal(isDirectEntrypoint(pathToFileURL(target).href, join(root, "other")), false);
|
|
assert.equal(isDirectEntrypoint(pathToFileURL(target).href, undefined), false);
|
|
assert.equal(resolve(target), target);
|
|
});
|