From e033b5f36c40ba46b57248e26ec0aa9fe7812d49 Mon Sep 17 00:00:00 2001 From: stduhpf Date: Tue, 16 Apr 2024 16:07:23 +0200 Subject: [PATCH] chore(tests): handle windows path formatting more gracefully (#460) --- tests/main.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/main.test.ts b/tests/main.test.ts index 71e0b4d..f07cb85 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -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, });