Skip to content

Commit

Permalink
chore: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
elrrrrrrr committed Dec 8, 2023
1 parent f281d19 commit 0999d8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sources/corepackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function installVersion(installTarget: string, locator: Locator, {s
};
}

const defaultNpmRegistryURL = spec.url.replace(/\{\}/g, version);
const defaultNpmRegistryURL = spec.url.replaceAll(`{}`, version);
const url = process.env.COREPACK_NPM_REGISTRY ?
defaultNpmRegistryURL.replace(
npmRegistryUtils.DEFAULT_NPM_REGISTRY_URL,
Expand Down
2 changes: 1 addition & 1 deletion sources/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getEndOfLine(content: string) {
}

export function normalizeLineEndings(originalContent: string, newContent: string) {
return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
return newContent.replaceAll(`{}`, getEndOfLine(originalContent));
}

function getIndent(content: string) {
Expand Down
12 changes: 6 additions & 6 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ for (const [name, version] of testedPackageManagers) {
await expect(runCli(cwd, [name, `--version`])).resolves.toMatchObject({
exitCode: 0,
stderr: ``,
stdout: expect.stringMatching(new RegExp(version.split(`+`, 1)[0])),
stdout: expect.stringContaining(version.split(`+`, 1)[0]),
});
});
});
Expand Down Expand Up @@ -223,7 +223,7 @@ it(`should use the pinned version when local projects don't list any spec`, asyn
});

await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
stderr: ``,
exitCode: 0,
});
Expand Down Expand Up @@ -333,7 +333,7 @@ it(`should refuse to run a different package manager within a configured project
exitCode: 0,
});
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
stderr: ``,
exitCode: 0,
});
Expand Down Expand Up @@ -364,7 +364,7 @@ it(`should always use fallback version when project spec env is disabled`, async
exitCode: 0,
});
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
stderr: ``,
exitCode: 0,
});
Expand Down Expand Up @@ -401,7 +401,7 @@ it(`should allow to call "corepack install -g --all" to prepare all package mana
});

await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
stderr: ``,
exitCode: 0,
});
Expand Down Expand Up @@ -552,7 +552,7 @@ it(`should support hydrating multiple package managers from cached archives`, as
});

await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
stdout: expect.stringMatching(/cnpm@9\.3\.2/),
stdout: expect.stringContaining(`cnpm@9.3.2`),
stderr: ``,
exitCode: 0,
});
Expand Down

0 comments on commit 0999d8b

Please sign in to comment.