Skip to content

Commit 0999d8b

Browse files
committed
chore: ci
1 parent f281d19 commit 0999d8b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

sources/corepackUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export async function installVersion(installTarget: string, locator: Locator, {s
117117
};
118118
}
119119

120-
const defaultNpmRegistryURL = spec.url.replace(/\{\}/g, version);
120+
const defaultNpmRegistryURL = spec.url.replaceAll(`{}`, version);
121121
const url = process.env.COREPACK_NPM_REGISTRY ?
122122
defaultNpmRegistryURL.replace(
123123
npmRegistryUtils.DEFAULT_NPM_REGISTRY_URL,

sources/nodeUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function getEndOfLine(content: string) {
1616
}
1717

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

2222
function getIndent(content: string) {

tests/main.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ for (const [name, version] of testedPackageManagers) {
9595
await expect(runCli(cwd, [name, `--version`])).resolves.toMatchObject({
9696
exitCode: 0,
9797
stderr: ``,
98-
stdout: expect.stringMatching(new RegExp(version.split(`+`, 1)[0])),
98+
stdout: expect.stringContaining(version.split(`+`, 1)[0]),
9999
});
100100
});
101101
});
@@ -223,7 +223,7 @@ it(`should use the pinned version when local projects don't list any spec`, asyn
223223
});
224224

225225
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
226-
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
226+
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
227227
stderr: ``,
228228
exitCode: 0,
229229
});
@@ -333,7 +333,7 @@ it(`should refuse to run a different package manager within a configured project
333333
exitCode: 0,
334334
});
335335
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
336-
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
336+
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
337337
stderr: ``,
338338
exitCode: 0,
339339
});
@@ -364,7 +364,7 @@ it(`should always use fallback version when project spec env is disabled`, async
364364
exitCode: 0,
365365
});
366366
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({
367-
stdout: expect.stringMatching(new RegExp(config.definitions.cnpm.default.split(`+`, 1)[0])),
367+
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(` + `, 1)[0]}`),
368368
stderr: ``,
369369
exitCode: 0,
370370
});
@@ -401,7 +401,7 @@ it(`should allow to call "corepack install -g --all" to prepare all package mana
401401
});
402402

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

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

0 commit comments

Comments
 (0)