From ecb0f20f9e413f61abbec71a82ef9c3a3efe7508 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 19 May 2025 12:10:46 +0200 Subject: [PATCH 1/6] fix older test --- integrations/upgrade/index.test.ts | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/integrations/upgrade/index.test.ts b/integrations/upgrade/index.test.ts index c70c83ddc6df..71e6bcd88911 100644 --- a/integrations/upgrade/index.test.ts +++ b/integrations/upgrade/index.test.ts @@ -2980,21 +2980,21 @@ test( } `, 'src/index.vue': html` - `, 'src/input.css': css` @@ -3016,21 +3016,21 @@ test( expect(await fs.dumpFiles('./src/**/*.{css,vue}')).toMatchInlineSnapshot(` " --- ./src/index.vue --- - --- ./src/input.css --- From bb61a87be89acbb7629b16291949f951e7d553d0 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 19 May 2025 12:04:01 +0200 Subject: [PATCH 2/6] add failing test --- integrations/upgrade/index.test.ts | 56 +++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/integrations/upgrade/index.test.ts b/integrations/upgrade/index.test.ts index 71e6bcd88911..f3b86dedf2f8 100644 --- a/integrations/upgrade/index.test.ts +++ b/integrations/upgrade/index.test.ts @@ -1,5 +1,6 @@ +import path from 'node:path' import { isRepoDirty } from '../../packages/@tailwindcss-upgrade/src/utils/git' -import { candidate, css, html, js, json, test, ts } from '../utils' +import { candidate, css, html, js, json, test, ts, yaml } from '../utils' test( 'error when no CSS file with @tailwind is used', @@ -2967,6 +2968,59 @@ test( }, ) +test( + 'upgrades can run in a pnpm workspace', + { + fs: { + 'package.json': json`{}`, + 'pnpm-workspace.yaml': yaml` + # + packages: + - project-a + `, + 'project-a/package.json': json` + { + "dependencies": { + "tailwindcss": "^4" + }, + "devDependencies": { + "@tailwindcss/upgrade": "workspace:^" + } + } + `, + 'project-a/src/index.html': html` + +
+ + +
+
+ + +
+ `, + 'project-a/src/input.css': css` + @import 'tailwindcss'; + + .foo { + @apply !bg-[var(--my-color)]; + } + `, + }, + }, + async ({ root, exec, fs, expect }) => { + let stdout = await exec('npx @tailwindcss/upgrade', { + cwd: path.join(root, 'project-a'), + }) + + expect(/Path .*? is not in cwd/.test(stdout)).toBe(false) + + expect(await fs.dumpFiles('./project-a/src/**/*.{css,html}')).toMatchInlineSnapshot() + }, +) + test( 'upgrade