From 49e98850e3a13502596ddade67385e1558328732 Mon Sep 17 00:00:00 2001 From: lsndr Date: Fri, 28 Nov 2025 13:28:10 +0400 Subject: [PATCH] test(e2e): run sandbox in system OS dir --- tests/{e2e/sandbox => .config}/sandbox.ts | 5 +++-- tests/e2e/commonjs.spec.ts | 2 +- tests/e2e/esm.spec.ts | 2 +- tests/e2e/sandbox/.gitignore | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) rename tests/{e2e/sandbox => .config}/sandbox.ts (93%) delete mode 100644 tests/e2e/sandbox/.gitignore diff --git a/tests/e2e/sandbox/sandbox.ts b/tests/.config/sandbox.ts similarity index 93% rename from tests/e2e/sandbox/sandbox.ts rename to tests/.config/sandbox.ts index ad081503..f0349a8c 100644 --- a/tests/e2e/sandbox/sandbox.ts +++ b/tests/.config/sandbox.ts @@ -1,8 +1,9 @@ import { execSync } from 'child_process'; -import { mkdirSync, rmSync, writeFileSync } from 'fs'; +import { mkdirSync, rmSync, writeFileSync, mkdtempSync } from 'fs'; import { rimrafSync } from 'rimraf'; import isCi from 'is-ci'; import * as path from 'path'; +import { tmpdir } from 'os'; export interface SandboxOptions { esm?: boolean; @@ -18,7 +19,7 @@ export class Sandbox { private readonly esm: boolean; public constructor(options?: SandboxOptions) { - this.projectPath = path.resolve(__dirname, 'app'); + this.projectPath = mkdtempSync(tmpdir()); this.esm = options?.esm ?? false; } diff --git a/tests/e2e/commonjs.spec.ts b/tests/e2e/commonjs.spec.ts index 939cad3e..d9c9ed23 100644 --- a/tests/e2e/commonjs.spec.ts +++ b/tests/e2e/commonjs.spec.ts @@ -6,7 +6,7 @@ import { RRule, RRuleSet, } from '../../src'; -import { Sandbox } from './sandbox/sandbox'; +import { Sandbox } from './../.config/sandbox'; import { beforeAll, afterAll, describe, it, expect } from 'vitest'; describe('Commonjs', () => { diff --git a/tests/e2e/esm.spec.ts b/tests/e2e/esm.spec.ts index 487c229e..03449a4c 100644 --- a/tests/e2e/esm.spec.ts +++ b/tests/e2e/esm.spec.ts @@ -6,7 +6,7 @@ import { RRuleSet, DtStart, } from '../../src'; -import { Sandbox } from './sandbox/sandbox'; +import { Sandbox } from './../.config/sandbox'; import { beforeAll, afterAll, describe, it, expect } from 'vitest'; describe('ESM', () => { diff --git a/tests/e2e/sandbox/.gitignore b/tests/e2e/sandbox/.gitignore deleted file mode 100644 index 7a0b7f00..00000000 --- a/tests/e2e/sandbox/.gitignore +++ /dev/null @@ -1 +0,0 @@ -app \ No newline at end of file