Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .configs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineConfig([
"reference/**",
"*.min.*",
// Deliberately-non-JS data files with a .js extension (fallback-loading tests); test data, not source.
"test/fixtures/**",
"tests/fixtures/**",
"**/package-lock.json",
// Copy file patterns
"*copy/",
Expand Down Expand Up @@ -73,7 +73,22 @@ export default defineConfig([
},
{ files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
{ files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: { ...globals.node, ...globals.browser } } },
{ files: ["test/**/*.mjs"], languageOptions: { globals: { ...globals.mocha } } },
{
files: ["tests/**/*.test.vitest.mjs"],
languageOptions: {
globals: {
beforeAll: true,
beforeEach: true,
afterAll: true,
afterEach: true,
describe: true,
it: true,
expect: true,
test: true,
vi: true
}
}
},
{ files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] },
{ files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] },
{ files: ["**/*.json5"], plugins: { json }, language: "json/json5", extends: ["json/recommended"] },
Expand Down
2 changes: 1 addition & 1 deletion .configs/fix-headers.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@cldmv/configs/fix-headers.json",
"excludeFolders": ["test/fixtures"]
"excludeFolders": ["tests/fixtures"]
}
54 changes: 54 additions & 0 deletions .configs/vitest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
*
* @Project: @cldmv/wisp
* @Filename: /.configs/vitest.config.mjs
* @Date: 2026-10-03T19:21:07-07:00 (1791080467)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-10-03T19:27:20-07:00 (1791080840)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*
*/

import { defineConfig } from "vitest/config";
import { fileURLToPath } from "node:url";
import path from "node:path";

// Anchor the project root to the package directory so include/exclude work no
// matter what cwd vitest is invoked from.
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");

export default defineConfig({
root,
test: {
include: ["tests/**/*.test.vitest.mjs"],
exclude: ["node_modules"],
environment: "node",
testTimeout: 30000,
// Run test files and the code under test through Node's native import()
// instead of Vite's module runner. wisp's behaviour depends on Node's real
// dynamic-import semantics (import attributes `with` / legacy `assert`, JSON
// module loading); the module runner ignores import attributes and loads JSON
// itself, so under it the suite would exercise Vite rather than Node.
// nodeLoader: false also skips Vitest's own loader transform (only needed for
// vi.mock / import.meta.vitest, which this suite does not use), so V8 coverage is
// measured against the files exactly as Node runs them.
experimental: {
viteModuleRunner: false,
nodeLoader: false
},
// "dot" keeps CI logs to one character per test file; the final
// "Test Files X passed" / "Tests Y passed" summary is unaffected.
reporters: ["dot"],
coverage: {
provider: "v8",
// wisp publishes src/ directly (no dist build), plus the two entry points.
include: ["src/**/*.mjs", "index.mjs", "index.cjs"],
exclude: ["**/*.json", "tests/**", "src/types/**"],
reporter: ["text", "html", "json-summary", "json"]
}
}
});
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ jobs:
# per-version regression. workflow_dispatch can still opt out (set false).
lts_only_matrix: ${{ github.event.inputs.lts_only_matrix != 'false' }}
package_manager: ${{ github.event.inputs.package_manager || 'npm' }}
test_command: "npm test" # mocha (test/**/*.mjs)
test_command: "npm test" # vitest via @cldmv/vitest-runner (tests/**/*.test.vitest.mjs), then the node:test CJS entry check
# test_command: "NODE_OPTIONS='--conditions=slothlet-dev' npm test" # Override NODE_OPTIONS only
# test_command: "NODE_ENV=test npm test" # Override NODE_ENV only
# test_command: "NODE_ENV=test NODE_OPTIONS='--conditions=slothlet-dev' npm test" # Override both
Expand All @@ -253,8 +253,13 @@ jobs:
# wisp's "build" is type-declaration generation. `build:types` (tsc) both
# emits types/ AND type-checks (tsc fails on type errors), so it carries
# the type check on every matrix node. Not `build:ci` β€” that also re-runs
# mocha, which `test_command` above already ran.
# the test suite, which `test_command` above already ran.
build_command: "npm run build:types"
# The coverage legs run their own build step before measuring. wisp ships
# src/ directly (no bundle), so its real build is the same type-declaration
# generation as the CI build; it leaves src/ in place, which is what the
# coverage include measures.
coverage_build_command: "npm run build:types"
skip_performance_tests: false
skip_matrix_tests: false

Expand All @@ -264,10 +269,9 @@ jobs:
# Only runs on direct pushes to default_branch β€” PRs and feature branches
# are automatically skipped so coverage always reflects merged master code.
# Requires: the coverage_command produces coverage/coverage-summary.json
# wisp has no coverage tooling (mocha only, no `ci:coverage` script, no
# coverage-summary.json, and no `badges` branch), so the coverage-badge
# job is disabled. Enable it once a coverage command is added.
enable_coverage_badge: false
# `npm run ci:coverage` runs the vitest suite with v8 coverage, whose
# json-summary reporter writes coverage/coverage-summary.json.
enable_coverage_badge: ${{ github.event.inputs.enable_coverage_badge != 'false' }}
default_branch: ${{ github.event.inputs.default_branch || 'master' }} # Badge only pushed when a push lands on this branch
coverage_command: ${{ github.event.inputs.coverage_command || 'npm run ci:coverage' }}
coverage_summary_path: ${{ github.event.inputs.coverage_summary_path || 'coverage/coverage-summary.json' }}
Expand All @@ -283,9 +287,7 @@ jobs:
# Injects a Shields.io badge + breakdown table directly into the PR body
# on every push to the PR branch. Only fires on pull_request events;
# skipped automatically on push and workflow_dispatch. No files committed.
# Disabled for the same reason as enable_coverage_badge above β€” no
# coverage data is produced, so there is nothing to inject into the PR.
enable_coverage_pr_comment: false
enable_coverage_pr_comment: ${{ github.event.inputs.enable_coverage_pr_comment != 'false' }}

# Authentication & Bot Configuration
# The workflow supports automatic App token detection for enhanced permissions and proper attribution:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
github_packages_publish_command: ""
min_node_version: ${{ github.event.inputs.min_node_version || '22.12.0' }}
max_node_major: ${{ github.event.inputs.max_node_major || '' }} # blank β‡’ inherit the CLDMV/.github reusable default
test_command: "npm test" # mocha (test/**/*.mjs)
test_command: "npm test" # vitest via @cldmv/vitest-runner (tests/**/*.test.vitest.mjs), then the node:test CJS entry check
# test_command: "NODE_OPTIONS='--conditions=slothlet-dev' npm test" # Override NODE_OPTIONS only
# test_command: "NODE_ENV=test npm test" # Override NODE_ENV only
# test_command: "NODE_ENV=test NODE_OPTIONS='--conditions=slothlet-dev' npm test" # Override both
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ package-lock.json
*.yml
*.yaml
reference/
test/fixtures/
tests/fixtures/
Loading
Loading