fix: colors on `forks` pool
Description
- Fixes https://github.com/vitest-dev/vitest/issues/7042
- Requires https://github.com/tinylibs/tinyrainbow/pull/3
This should probably be ported to v2 as colors are not working in latest there.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
- [ ] Ideally, include a test that fails without this PR but passes with it.
- [ ] Please, don't make changes to
pnpm-lock.yamlunless you introduce a new test example.
Tests
- [ ] Run the tests with
pnpm test:ci.
Documentation
- [ ] If you introduce new functionality, document it. You can run documentation with
pnpm run docscommand.
Changesets
- [ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with
feat:,fix:,perf:,docs:, orchore:.
Deploy Preview for vitest-dev ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | e4153c7f9a6ff7b92781019783cfd0fdf57cacfe |
| Latest deploy log | https://app.netlify.com/sites/vitest-dev/deploys/67855bcce585af00087e6722 |
| Deploy Preview | https://deploy-preview-7090--vitest-dev.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Windows CI is failing. It's like it didn't set isatty(1) as false when forked process's stdout is captured into buffer. 🤔
Anyone with Windows machine to check what following script prints?
import { writeFileSync } from "node:fs";
import { fork } from "node:child_process";
import { setTimeout } from "node:timers/promises";
import { isatty } from "node:tty";
console.log("main thread", isatty(1));
writeFileSync(
"./worker.mjs",
`
import { isatty } from "node:tty";
console.log("process", isatty(1));
`.trim(),
"utf8"
);
const subprocess = fork("./worker.mjs", { stdio: "pipe" });
subprocess.stdout.pipe(process.stdout);
subprocess.stderr.pipe(process.stderr);
await setTimeout(3_000);
subprocess.kill();
It's likely caused by colors being enabled on based on platform here: https://github.com/tinylibs/tinyrainbow/blob/550fbcdc56b9b2d69230e73b48e3d7ba0dc2e60c/src/index.ts#L91
I'll add skip to windows on tests.