Certainly its arbitrary, but its a bit ridiculous to need to run the discourse_theme from a local clone of discourse when the discourse instance being tested is not the local instance.
Anyway, I have done as you suggested, both in a fresh github codespace, and in my own dev environment, and it still throws the same errors.
Reading through all of the log (or all the ones that will fit in the terminal history), all the directories it is erroring on is /node_modules/.pnpm. Testing and running discourse_theme against a different TC that has yet to be updated to use pnpm instead of yarn, I don’t see any errors, so I’m almost 100% certain the issue is with it watching .pnpm.
From Symlinked `node_modules` structure | pnpm, it looks like the normal structure of node_modules is preserved by moving all the actual code into /node_modules/.pnpm and the rest of directories in /node_modules/ are just symlinks to .pnpm. So ignoring .pnpm avoids the “directory is already being watched!” error.
I’ve played a bit with the discourse_theme gem and added listener.ignore /node_modules\/\.pnpm/ to the watcher.rb, and it seems to work fine without any error messages. It even detected a new pnpm package install.