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

Code before:
    name,
    { timeout: TEST_TIMEOUT },
    async (options) => {
      let rootDir = debug
        ? path.join(REPO_ROOT, '.debug')
        : // On Windows CI, tmpdir returns a path containing a weird RUNNER~1
          // folder  that apparently causes the vite builds to not work.
          process.env.CI && platform() === 'win32'
          ? homedir()
          : tmpdir()
      await fs.mkdir(rootDir, { recursive: true })

      let root = await fs.mkdtemp(path.join(rootDir, 'tailwind-integrations'))

      if (debug) {
        console.log('Running test in debug mode. File system will be written to:')
        console.log(root)
        console.log()
      }

      let context = {
        root,
        async exec(command: string, childProcessOptions: ChildProcessOptions = {}) {
          if (debug) console.log(`> ${command}`)
          return execSync(command, {
            cwd: root,
            stdio: 'pipe',
            ...childProcessOptions,
          }).toString()
        },
        async spawn(command: string, childProcessOptions: ChildProcessOptions = {}) {
          let resolveDisposal: (() => void) | undefined
          let rejectDisposal: ((error: Error) => void) | undefined
          let disposePromise = new Promise<void>((resolve, reject) => {
            resolveDisposal = resolve
            rejectDisposal = reject
          })

          if (debug) console.log(`>& ${command}`)
          let child = spawn(command, {
            cwd: root,
            shell: true,
            env: {
              ...process.env,
            },
            ...childProcessOptions,
          })

          function dispose() {
            child.kill()


Review comment (bug):
While testing I ran into an issue that I was executing the commands in the wrong folder. If we pass in a custom `cwd`, I think we should show that as a step as well:
```suggestion
          let cwd = childProcessOptions.cwd ?? root
          if (debug && cwd !== root) {
            let relative = path.relative(root, cwd)
            if (relative[0] !== '.') relative = `./${relative}`
            console.log(`> cd ${relative}`)
          }
          if (debug) console.log(`> ${command}`)
          return execSync(command, {
            cwd,
```

This results in:
<img width="1242" alt="image" src="https://github.com/user-attachments/assets/a8198aee-2fdd-474c-a638-7cef5ef71f88">


Code after:
    name,
    { timeout: TEST_TIMEOUT },
    async (options) => {
      let rootDir = debug
        ? path.join(REPO_ROOT, '.debug')
        : // On Windows CI, tmpdir returns a path containing a weird RUNNER~1
          // folder  that apparently causes the vite builds to not work.
          process.env.CI && platform() === 'win32'
          ? homedir()
          : tmpdir()
      await fs.mkdir(rootDir, { recursive: true })

      let root = await fs.mkdtemp(path.join(rootDir, 'tailwind-integrations'))

      if (debug) {
        console.log('Running test in debug mode. File system will be written to:')
        console.log(root)
        console.log()
      }

      let context = {
        root,
        async exec(command: string, childProcessOptions: ChildProcessOptions = {}) {
          let cwd = childProcessOptions.cwd ?? root
          if (debug && cwd !== root) {
            let relative = path.relative(root, cwd)
            if (relative[0] !== '.') relative = `./${relative}`
            console.log(`> cd ${relative}`)
          }
          if (debug) console.log(`> ${command}`)
          return execSync(command, {
            cwd,
            stdio: 'pipe',
            ...childProcessOptions,
          }).toString()
        },
        async spawn(command: string, childProcessOptions: ChildProcessOptions = {}) {
          let resolveDisposal: (() => void) | undefined
          let rejectDisposal: ((error: Error) => void) | undefined
          let disposePromise = new Promise<void>((resolve, reject) => {
            resolveDisposal = resolve
            rejectDisposal = reject
          })

          let cwd = childProcessOptions.cwd ?? root
          if (debug && cwd !== root) {
            let relative = path.relative(root, cwd)
            if (relative[0] !== '.') relative = `./${relative}`
            console.log(`> cd ${relative}`)
          }
          if (debug) console.log(`>& ${command}`)