describe("parseVitestProcessStats", () => {
it("counts other Vitest roots and workers while excluding the current pid", () => {
expect(
parseVitestProcessStats(
[ "101 0.0 node /Users/me/project/node_modules/.bin/vitest run --config vitest.config.ts", "102 41.3 /opt/homebrew/bin/node /Users/me/project/node_modules/vitest/dist/workers/forks.js", "103 37.4 /opt/homebrew/bin/node /Users/me/project/node_modules/vitest/dist/workers/forks.js", "200 12.0 node /Users/me/project/node_modules/.bin/vitest run --config test/vitest/vitest.unit.config.ts", "201 25.5 node unrelated-script.mjs",
].join("\n"), 200,
),
).toEqual({
otherVitestRootCount: 1,
otherVitestWorkerCount: 2,
otherVitestCpuPercent: 78.7,
});
});
});
describe("base vitest config", () => {
it("defaults the base pool to threads", () => {
expect(resolveDefaultVitestPool()).toBe("threads");
expect(baseConfig.test?.pool).toBe("threads");
});
it("excludes fixture trees from test collection", () => {
expect(baseConfig.test?.exclude).toContain("test/fixtures/**");
});
it("keeps the base setup file minimal", () => {
expect(baseConfig.test?.setupFiles).toHaveLength(1);
expect(baseConfig.test?.setupFiles?.[0]).toMatch(/(?:^|\/)test\/setup\.ts$/u);
});
it("keeps the base runner non-isolated by default", () => {
expect(baseConfig.test?.isolate).toBe(false);
expect(baseConfig.test?.runner).toMatch(/(?:^|\/)test\/non-isolated-runner\.ts$/u);
});
});
describe("test scripts", () => {
it("keeps test scripts on the native thread-first configs", () => { const pkg = JSON.parse(
readFileSync(new URL("../../package.json", import.meta.url), "utf8"),
) as {
scripts?: Record<string, string>;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.