Skip to content

Commit 746ce33

Browse files
authored
fix(core): prevent validation error in version/publish with workspace: prefix (#3322)
1 parent 674ffd3 commit 746ce33

2 files changed

Lines changed: 0 additions & 40 deletions

File tree

core/package-graph/__tests__/package-graph.test.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -300,31 +300,6 @@ describe("PackageGraph", () => {
300300
`"Package specification \\"test-1@^1.1.0\\" could not be resolved within the workspace. To reference a non-matching, remote version of a local dependency, remove the 'workspace:' prefix."`
301301
);
302302
});
303-
304-
it("throws an error when sibling package does not exist in the workspace, regardless of version specification", () => {
305-
const packages = [
306-
new Package(
307-
{
308-
name: "test-1",
309-
version: "1.0.0",
310-
},
311-
"/test/test-1"
312-
),
313-
new Package(
314-
{
315-
name: "test-2",
316-
version: "1.0.0",
317-
dependencies: {
318-
"test-3": "workspace:^1.0.0",
319-
},
320-
},
321-
"/test/test-2"
322-
),
323-
];
324-
expect(() => new PackageGraph(packages)).toThrowErrorMatchingInlineSnapshot(
325-
`"Package specification \\"test-3@^1.0.0\\" could not be resolved within the workspace. To use the 'workspace:' protocol, ensure that a package with name \\"test-3\\" exists in the current workspace."`
326-
);
327-
});
328303
});
329304
});
330305

@@ -621,14 +596,6 @@ Set {
621596
});
622597
});
623598

624-
// eslint-disable-next-line no-unused-vars
625-
function deepInspect(obj) {
626-
// jest console mutilates console.dir() options argument,
627-
// so sidestep it by requiring the non-shimmed method directly.
628-
// eslint-disable-next-line global-require
629-
require("console").dir(obj, { depth: 10, compact: false });
630-
}
631-
632599
function topoPackages() {
633600
return [
634601
{

core/package-graph/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ class PackageGraph extends Map {
7373
fullWorkspaceSpec = spec;
7474
spec = spec.replace(/^workspace:/, "");
7575

76-
if (!depNode) {
77-
throw new ValidationError(
78-
"EWORKSPACE",
79-
`Package specification "${depName}@${spec}" could not be resolved within the workspace. To use the 'workspace:' protocol, ensure that a package with name "${depName}" exists in the current workspace.`
80-
);
81-
}
82-
8376
// replace aliases (https://pnpm.io/workspaces#referencing-workspace-packages-through-aliases)
8477
if (spec === "*" || spec === "^" || spec === "~") {
8578
workspaceAlias = spec;

0 commit comments

Comments
 (0)