Repository: tailwindlabs/tailwindcss
File: integrations/utils.ts (TypeScript)

Code before:
              files.map(async (file) => {
                let content = await fs.readFile(path.join(root, file), 'utf8')
                return [file, content]
              }),
            )
          },
          async expectFileToContain(filePath, contents) {
            return retryUntil(async () => {
              let fileContent = await this.read(filePath)
              for (let content of contents) {
                expect(fileContent).toContain(content)
              }
            })
          },
        },
      } satisfies TestContext

      for (let [filename, content] of Object.entries(config.fs)) {
        await context.fs.write(filename, content)
      }

      try {
        // In debug mode, the directory is going to be inside the pnpm workspace
        // of the tailwindcss package. This means that `pnpm install` will run
        // pnpm install on the workspace instead (expect if the root dir defines
        // a seperate workspace). We work around this by using the
        // --ignore-workspace flag.
        let ignoreWorkspace = debug && !config.fs['pnpm-workspace.yaml']
        context.exec(`pnpm install${ignoreWorkspace ? ' --ignore-workspace' : ''}`)
      } catch (error: any) {
        console.error(error)
        throw error
      }

      let disposables: (() => Promise<void>)[] = []

      async function dispose() {
        await Promise.all(disposables.map((dispose) => dispose()))

        // Skip removing the directory in CI beause it can stall on Windows
        if (!process.env.CI && !debug) {
          await fs.rm(root, { recursive: true, force: true })
        }
      }

      options.onTestFinished(dispose)

      return await testCallback(context)
    },
  )
}

Review comment (suggestion):
```suggestion
        // a separate workspace). We work around this by using the
```

Code after:
              files.map(async (file) => {
                let content = await fs.readFile(path.join(root, file), 'utf8')
                return [file, content]
              }),
            )
          },
          async expectFileToContain(filePath, contents) {
            return retryUntil(async () => {
              let fileContent = await this.read(filePath)
              for (let content of contents) {
                expect(fileContent).toContain(content)
              }
            })
          },
        },
      } satisfies TestContext

      for (let [filename, content] of Object.entries(config.fs)) {
        await context.fs.write(filename, content)
      }

      try {
        // In debug mode, the directory is going to be inside the pnpm workspace
        // of the tailwindcss package. This means that `pnpm install` will run
        // pnpm install on the workspace instead (expect if the root dir defines
        // a separate workspace). We work around this by using the
        // `--ignore-workspace` flag.
        let ignoreWorkspace = debug && !config.fs['pnpm-workspace.yaml']
        context.exec(`pnpm install${ignoreWorkspace ? ' --ignore-workspace' : ''}`)
      } catch (error: any) {
        console.error(error)
        throw error
      }

      let disposables: (() => Promise<void>)[] = []

      async function dispose() {
        await Promise.all(disposables.map((dispose) => dispose()))

        // Skip removing the directory in CI beause it can stall on Windows
        if (!process.env.CI && !debug) {
          await fs.rm(root, { recursive: true, force: true })
        }
      }

      options.onTestFinished(dispose)

      return await testCallback(context)
    },
  )
}