mirror of https://github.com/nodejs/corepack.git
chore(tests): handle windows path formatting more gracefully (#460)
This commit is contained in:
parent
32a93ea4f5
commit
e033b5f36c
|
|
@ -1,7 +1,6 @@
|
||||||
import {beforeEach, describe, expect, it} from '@jest/globals';
|
import {beforeEach, describe, expect, it} from '@jest/globals';
|
||||||
import {Filename, ppath, xfs, npath, PortablePath} from '@yarnpkg/fslib';
|
import {Filename, ppath, xfs, npath, PortablePath} from '@yarnpkg/fslib';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
|
||||||
import config from '../config.json';
|
import config from '../config.json';
|
||||||
|
|
@ -421,8 +420,7 @@ it(`should refuse to run a different package manager within a configured project
|
||||||
|
|
||||||
await expect(runCli(cwd, [`pnpm`, `--version`])).resolves.toMatchObject({
|
await expect(runCli(cwd, [`pnpm`, `--version`])).resolves.toMatchObject({
|
||||||
stdout: `Usage Error: This project is configured to use yarn because ${
|
stdout: `Usage Error: This project is configured to use yarn because ${
|
||||||
// ppath and xfs do not format Windows correctly, the regex fixes that:
|
npath.fromPortablePath(ppath.join(cwd, `package.json` as Filename))
|
||||||
path.join(cwd.replace(/^\/([a-zA-Z]:)\//, `$1\\`), `package.json`)
|
|
||||||
} has a "packageManager" field\n\n$ pnpm ...\n`,
|
} has a "packageManager" field\n\n$ pnpm ...\n`,
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue