Skip to content

Commit

Permalink
feat: when strict checking is off, treat like transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed Oct 20, 2022
1 parent 0b7abb9 commit bc08ee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sources/specUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export async function findProjectSpec(initialCwd: string, locator: Locator, {tra
// A locator is a valid descriptor (but not the other way around)
const fallbackLocator = {name: locator.name, range: locator.reference};

if (process.env.COREPACK_ENABLE_STRICT === `0`) return fallbackLocator;
if (process.env.COREPACK_ENABLE_STRICT === `0`)
transparent = true;

while (true) {
const result = await loadSpec(initialCwd);
Expand Down
6 changes: 6 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,14 @@ it(`should refuse to run a different package manager within a configured project
process.env.COREPACK_ENABLE_STRICT = `0`;

try {
await expect(runCli(cwd, [`yarn`, `--version`])).resolves.toMatchObject({
stdout: `1.0.0\n`,
stderr: ``,
exitCode: 0,
});
await expect(runCli(cwd, [`pnpm`, `--version`])).resolves.toMatchObject({
stdout: `${config.definitions.pnpm.default.split(`+`, 1)[0]}\n`,
stderr: ``,
exitCode: 0,
});
} finally {
Expand Down

0 comments on commit bc08ee3

Please sign in to comment.