chore(tests): handle windows path formatting more gracefully (#460)

This commit is contained in:
stduhpf 2024-04-16 16:07:23 +02:00 committed by GitHub
parent 32a93ea4f5
commit e033b5f36c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -1,7 +1,6 @@
import {beforeEach, describe, expect, it} from '@jest/globals';
import {Filename, ppath, xfs, npath, PortablePath} from '@yarnpkg/fslib';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
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({
stdout: `Usage Error: This project is configured to use yarn because ${
// ppath and xfs do not format Windows correctly, the regex fixes that:
path.join(cwd.replace(/^\/([a-zA-Z]:)\//, `$1\\`), `package.json`)
npath.fromPortablePath(ppath.join(cwd, `package.json` as Filename))
} has a "packageManager" field\n\n$ pnpm ...\n`,
exitCode: 1,
});