Skip to content

Commit

Permalink
limit test workers for vitest integration tests
Browse files Browse the repository at this point in the history
make vitest tests silent
make cypress tests silent
  • Loading branch information
epszaw committed Apr 6, 2024
1 parent e6c7b5d commit 6f21349
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 253 deletions.
127 changes: 9 additions & 118 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/allure-cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"coverage": "codecov",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"pretest": "rimraf ./test/fixtures",
"test": "vitest run --dir ./test/spec"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/allure-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class AllureCypress {
currentTestsByAbsolutePath = new Map<string, [AllureTest, number][]>();
// need to keep the variable here because we recieve end-message and finish the current test separately
currentSteps: AllureStep[] = [];

constructor(private config?: AllureCypressConfig) {
this.runtime = new AllureNodeRuntime({
writer: new FileSystemAllureWriter({
Expand Down
6 changes: 2 additions & 4 deletions packages/allure-cypress/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fork } from "node:child_process";
import { randomUUID } from "node:crypto";
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
import { join, resolve } from "node:path";
import type { AllureResults } from "allure-js-commons";

Expand Down Expand Up @@ -68,7 +68,7 @@ export const runCypressInlineTest = async (

const moduleRootPath = require.resolve("cypress");
const modulePath = resolve(moduleRootPath, "../bin/cypress");
const args = ["run", "-s", testFilePath];
const args = ["run", "-s", testFilePath, "-q"];
const testProcess = fork(modulePath, args, {
env: {
...process.env,
Expand Down Expand Up @@ -106,8 +106,6 @@ export const runCypressInlineTest = async (
}
}

await rm(testDir, { recursive: true });

return resolve(res);
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/allure-jest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/fixtures/
1 change: 1 addition & 0 deletions packages/allure-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"coverage": "codecov",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"pretest": "rimraf ./test/fixtures",
"test": "jest"
},
"dependencies": {
Expand Down
8 changes: 2 additions & 6 deletions packages/allure-jest/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fork } from "node:child_process";
import { randomUUID } from "node:crypto";
import { mkdir, rm, writeFile } from "node:fs/promises";
import { mkdir, writeFile } from "node:fs/promises";
import { join } from "node:path";
import type { AllureResults, TestResult, TestResultContainer } from "allure-js-commons";

Expand Down Expand Up @@ -79,10 +79,6 @@ export const runJestInlineTest = async (test: string): Promise<AllureResults> =>
});

return new Promise((resolve) => {
testProcess.on("exit", async () => {
await rm(testDir, { recursive: true });

return resolve(res);
});
testProcess.on("exit", () => resolve(res));
});
};
4 changes: 2 additions & 2 deletions packages/allure-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"compile": "tsc",
"generate-report": "allure generate ./out/allure-results -o ./out/allure-report --clean",
"allure-report": "allure serve ./out/allure-results",
"pretest": "run compile",
"pretest": "run compile && rimraf ./test/fixtures",
"test": "vitest run --dir ./test/spec --config ./vitest.config.ts",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix"
Expand All @@ -65,6 +65,6 @@
"rimraf": "^5.0.1",
"typescript": "^5.2.2",
"vite": "^5.0.11",
"vitest": "^1.1.3"
"vitest": "^1.4.0"
}
}
10 changes: 3 additions & 7 deletions packages/allure-vitest/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fork } from "node:child_process";
import { randomUUID } from "node:crypto";
import { mkdir, rm, writeFile } from "node:fs/promises";
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "url";
import type { AllureResults, TestResult, TestResultContainer } from "allure-js-commons";
Expand Down Expand Up @@ -58,7 +58,7 @@ export const runVitestInlineTest = async (
await beforeTestCb(testDir);
}

const modulePath = require.resolve("vitest/dist/cli-wrapper.js");
const modulePath = require.resolve("vitest/vitest.mjs");
const args = ["run", "--config", configFilePath, "--dir", testDir];
const testProcess = fork(modulePath, args, {
env: {
Expand Down Expand Up @@ -96,10 +96,6 @@ export const runVitestInlineTest = async (
});

return new Promise((resolve, reject) => {
testProcess.on("exit", async () => {
await rm(testDir, { recursive: true });

return resolve(res);
});
testProcess.on("exit", () => resolve(res));
});
};
1 change: 1 addition & 0 deletions packages/allure-vitest/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AllureReporter from "allure-vitest/reporter";
export default defineConfig({
test: {
testTimeout: 10000,
fileParallelism: false,
setupFiles: ["allure-vitest/setup"],
reporters: [
"default",
Expand Down
1 change: 1 addition & 0 deletions packages/hermione-allure/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/fixtures/
Loading

0 comments on commit 6f21349

Please sign in to comment.