Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
make test execution deterministic
Thiago Araujo da Silva58d947f62c15
diff --git a/backend/vitest.e2e.config.mts b/backend/vitest.e2e.config.mtsindex 78b0f0a83f..6534ea285f 100644--- a/backend/vitest.e2e.config.mts+++ b/backend/vitest.e2e.config.mts@@ -1,5 +1,28 @@import path from "path";import { defineConfig } from "vitest/config";+import { BaseSequencer, type TestSpecification } from "vitest/node";++// Vitest's default sequencer picks one of two orders depending on whether a+// results cache exists: size-descending when it doesn't, and+// failed-first-then-slowest-first when it does. That cache lives at+// `node_modules/.vite/vitest/<hash>/results.json` — inside the very directory+// CI restores from `actions/cache`, keyed on package-lock.json. So the suite+// runs in size order on the first build after a dependency bump, then in a+// frozen duration order for every build after that, and developers get whatever+// their own local cache implies.+//+// These specs share one database and one seeded org, so run order is part of+// their contract; an order that silently changes turns shared-state bugs into+// flakes that reproduce on some builds and not others. Sorting by path is+// deterministic everywhere and costs nothing here: the size heuristic exists to+// pack parallel workers, and this suite is deliberately single-fork with+// `fileParallelism: false`.+class PathSequencer extends BaseSequencer {+ // eslint-disable-next-line class-methods-use-this+ async sort(files: TestSpecification[]) {+ return [...files].sort((a, b) => a.moduleId.localeCompare(b.moduleId));+ }+}export default defineConfig({test: {@@ -15,6 +38,7 @@ export default defineConfig({include: ["./e2e-test/**/*.spec.ts"],// Runs per test file, after the environment is up — see the file for why.setupFiles: ["./e2e-test/setup/reset-shared-org-flags.ts"],+ sequence: { sequencer: PathSequencer },pool: "forks",poolOptions: {forks: {