Skip to content

Commit c336e33

Browse files
committed
refactor(test): reorganize tests into unit and integration directories
Restructure test directory to separate unit tests from integration tests: - test/unit/ - Fast unit tests (all existing tests) - test/integration/ - Integration tests requiring TTY/process spawning - stdio/mask.test.ts moved here (requires TTY mocking) Updated vitest config to include both directories. Fixed relative imports in tests that moved directories. Fixed esbuild config to use inline envAsBoolean helper. Test structure now clearly separates concerns and makes it easier to run fast unit tests vs slower integration tests. All 5151 tests still pass.
1 parent 66e0622 commit c336e33

File tree

115 files changed

+19
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+19
-5
lines changed

.config/esbuild.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ import path from 'node:path'
77
import { fileURLToPath } from 'node:url'
88
import fg from 'fast-glob'
99

10-
import { envAsBoolean } from '#socketsecurity/lib/env/utils'
1110
import { getLocalPackageAliases } from '../scripts/utils/get-local-package-aliases.mjs'
1211

12+
// Helper to check boolean env vars
13+
const envAsBoolean = name => {
14+
const value = process.env[name]
15+
return value === 'true' || value === '1'
16+
}
17+
1318
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1419
const rootPath = path.join(__dirname, '..')
1520
const srcPath = path.join(rootPath, 'src')

.config/vitest.config.mts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ export default defineConfig({
5353
environment: 'node',
5454
include: [
5555
toGlobPath(
56-
path.resolve(projectRoot, 'test/**/*.test.{js,ts,mjs,mts,cjs,cts}'),
56+
path.resolve(
57+
projectRoot,
58+
'test/unit/**/*.test.{js,ts,mjs,mts,cjs,cts}',
59+
),
60+
),
61+
toGlobPath(
62+
path.resolve(
63+
projectRoot,
64+
'test/integration/**/*.test.{js,ts,mjs,mts,cjs,cts}',
65+
),
5766
),
5867
],
5968
exclude: [
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)