UNPKG

yarn-changed-workspaces

Version:

An utility to show changed workspaces and their dependants

26 lines (23 loc) 730 B
const { filterWorkspaces } = require("./filterWorkspaces"); describe("filterWorkspaces", () => { test("it selects files which match workspace path", () => { expect( filterWorkspaces({ workspace: { id: "myapp", path: "/myapp" }, files: ["/myapp/src/myfile.js", "/test/myfile.js"], }) ).toEqual(["/myapp/src/myfile.js"]); }); test("it filters files based on config.files", () => { expect( filterWorkspaces({ workspace: { id: "myapp", path: "/myapp", config: { files: ["!**/*.test.js", "**/*.js"] }, }, files: ["/myapp/src/myfile.js", "/myapp/src/mytest.test.js"], }) ).toEqual(["/myapp/src/myfile.js"]); }); });