workspace-tools
Version:
A collection of tools that are useful in a git-controlled monorepo that is managed by one of these software:
26 lines (25 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const setupFixture_1 = require("../helpers/setupFixture");
const lockfile_1 = require("../lockfile");
describe("parseLockFile()", () => {
it("parses yarn.lock file when it is found", async () => {
const packageRoot = await setupFixture_1.setupFixture("basic");
const parsedLockeFile = await lockfile_1.parseLockFile(packageRoot);
expect(parsedLockeFile).toHaveProperty("type", "success");
});
it("throws if it cannot find a yarn.lock file", async () => {
const packageRoot = await setupFixture_1.setupFixture("basic-without-lock-file");
await expect(lockfile_1.parseLockFile(packageRoot)).rejects.toThrow("You do not have either yarn.lock nor pnpm-lock.yaml. Please use one of these package managers");
});
it("parses combined ranges in yarn.lock", async () => {
const packageRoot = await setupFixture_1.setupFixture("basic-yarn");
const parsedLockeFile = await lockfile_1.parseLockFile(packageRoot);
expect(parsedLockeFile.object["@babel/code-frame@^7.0.0"].version).toBe(parsedLockeFile.object["@babel/code-frame@^7.8.3"].version);
});
it("parses pnpm-lock.yaml properly", async () => {
const packageRoot = await setupFixture_1.setupFixture("basic-pnpm");
const parsedLockeFile = await lockfile_1.parseLockFile(packageRoot);
expect(Object.keys(parsedLockeFile.object["yargs@16.2.0"].dependencies)).toContain("cliui");
});
});