Skip to content

Tests tightened, action API simplified, dependency bumps, and CI/config cleanup

Choose a tag to compare

released this 02 Oct 17:42
· 54 commits to working since this release

This release focuses on tightening linting and tests, simplifying action/allAction APIs and operations wrappers, updating Fjell runtime and ESLint tooling versions, and reducing local commit/CI friction. The changes are grouped to help developers understand what changed, why it was changed, and how it affects usage, testing, and publishing.

Highlights

  • Enforced standard lint rules for tests by removing a test-specific ESLint override.
  • Simplified action and allAction APIs to return direct values (no affected-items tuple), and updated wrappers and related tests accordingly.
  • Expanded and reorganized the test suite with new example and library tests and centralized mocks for cleaner, stricter tests.
  • Removed the heavy local precommit pipeline and a separate CI build job to reduce local/CI friction during development and publishing.
  • Bumped several @fjell runtime packages and ESLint-related tooling; updated lockfile entries to keep installs reproducible.

New Features

  • Tests: Added new unit and example tests to improve coverage and exercise example code paths
    • tests/Library.test.ts: new comprehensive unit test suite for library creation and isLibrary checks, including mocked logging and registry modules.
    • tests/examples/*: new example-based test files added to validate example entry points and safe invocation (enterprise-example, library-architecture-example, multi-level-keys, simple-example).
    • These tests centralize mocks (vi.mock) and use consistent mockConsole placeholders to avoid scattered inline mocking and duplicated setup.

Improvements

  • Linting and test consistency

    • Removed the tests-only ESLint override that relaxed the "no-undefined" rule in eslint.config.mjs; tests now follow the same lint rules as the source. (Removed test-specific override block in eslint.config.mjs)
    • Cleared many inline "eslint-disable" comments and redundant blank lines in test files to surface real lint failures and encourage explicit handling of undefined values.
  • Test maintainability and structure

    • Centralized module mocking using vi.mock to avoid repeated inline mocks across tests.
    • Replaced ad-hoc console mocking with a small mockConsole placeholder in example tests.
    • Adjusted several tests under tests/ops and tests/contained to remove suppressed rules and to pass explicit undefined where needed, improving clarity of expectations.
  • Packaging and commit workflow

    • Removed the heavy precommit script from package.json (precommit) to avoid expensive local hooks during commits; build/test/lint can still be run manually or in CI.
    • Removed the separate build job from .github/workflows/npm-publish.yml so the publish job no longer depends on a removed job; simplifies the workflow graph.
  • Operations wrapper safety and clarity

    • Operations wrappers (src/Operations.ts and variants) now guard collection spreads: use { ...(toWrap.foo || {}), ...(options.foo || {}) } to avoid runtime errors when options or toWrap collections are missing.
    • Introduced local operations object construction in wrapper implementations (instead of duplicated/complex return plumbing) to make intent and formatting clearer.
    • Simplified wrapAllActionOperation and related wrappers by removing duplicated parameter blocks and making the signatures leaner.

Bug Fixes

  • Tests and expectations

    • Fixed contained library test to remove redundant comments and keep behavior when parent is undefined; assertions now explicitly expect result.parent to be undefined.
    • Adjusted ops tests to call methods with explicit undefined arguments instead of using disabled lint rules; this aligns tests with the stricter ESLint behavior now enforced.
  • Wrapper runtime safety

    • Prevented potential runtime crashes when spreading undefined objects in operations wrappers by adding default empty-object fallbacks in spreads (see src/Operations.ts changes described above).

Refactoring

  • Action/allAction API simplification

    • Removed the tuple return type that previously returned [value, affectedItems] from action and allAction APIs.
    • Action and AllAction methods now return a single value or an array of values (V | V[]) directly; the affected-items plumbing was removed from signatures, callers, and tests.
    • Files updated for this simplification include: src/ops/action.ts, src/ops/allAction.ts, src/Options.ts, and the operations wrappers (src/Operations.ts, src/contained/Operations.ts, src/primary/Operations.ts).
    • Tests across tests/ops and tests/primary were updated to reflect the new single-value returns and remove assertions and mocks that expected affected-item tuples.
  • Wrapper and formatting cleanups

    • Made signature formatting and parameter blocks consistent and simpler in several ops wrappers (notably wrapAllActionOperation).
    • Tidy changes in Operations wrapper implementations to use shared wrapAbstractOperations behavior where applicable and to avoid duplicated parameter lists.
    • Inserted /* eslint-disable indent */ where necessary in a small set of files to avoid failing lint due to formatting changes introduced while tidying wrapper code.

Testing Improvements

  • Coverage and Vitest config

    • Removed duplicate branch coverage thresholds from vitest.config.ts to avoid conflicting coverage settings and to make coverage thresholds unambiguous.
  • Tests updated and cleaned

    • Many tests had inline disables and inconsistent mocking patterns corrected; expectations and mocked logger behavior adjusted to match clearer error messages and simplified return formats.
    • Example tests were added primarily to assert that example modules export expected functions and that invocation of those functions does not throw; these tests mock/replace heavy example behavior to keep tests lightweight.

Configuration and CI changes

  • CI workflow

    • Removed the separate build job from the GitHub Actions publish workflow so publish-npm no longer depends on a removed job. This reduces workflow complexity.
  • package.json and package-lock.json

    • Removed duplicate/hard-coded version entries in package.json (duplicate version lines removed); this change moves package.json away from containing multiple version declarations that could conflict with external version management.
    • Deleted the local precommit script to reduce local commit friction.
    • Restored and normalized package.json formatting and EOF newlines in several edits.
    • Updated package-lock.json entries to align with bumped dependency versions (lockfile-only metadata updates for reproducible installs).

Dependency Updates

  • Runtime dependency bumps in package.json

    • @fjell/core -> ^4.4.42
    • @fjell/logging -> ^4.4.47
    • @fjell/registry -> ^4.4.39
  • ESLint tooling and devDependencies

    • @fjell/eslint-config -> ^1.1.25
    • Added @eslint/eslintrc ^3.3.1 and @eslint/js ^9.32.0 to devDependencies
    • These changes are intended to align lint configuration and ESLint packages with the rest of the codebase and to support stricter lint rules in tests.
  • Lockfile updates

    • package-lock.json was updated to match the bumped versions above and ensure reproducible installs (updated metadata, resolved URLs, and integrity hashes for affected packages).

Breaking Changes and Migration Notes

  • Action/allAction return shape changed

    • Previously, action and allAction methods could return a tuple [result, affectedItems]. Those APIs were simplified to return the result directly (V or V[]).
    • Any custom code or plugins that relied on the old tuple form must be updated to work with the direct return value. Review code that consumes action/allAction results and adjust expectations and tests accordingly.
  • Tests and linting

    • Tests now run under the same lint rules as source files. Tests that previously relied on disabled rules (for example relying on implicit use of undefined) must be updated to explicitly pass undefined or otherwise satisfy the linter.
  • Precommit script removed

    • Local workflows that previously relied on package.json precommit being executed automatically (precommit script) will no longer run. CI or developer tooling should be used to enforce pre-commit validation if required.

Files and areas affected (selected)

  • Source

    • src/Operations.ts, src/contained/Operations.ts, src/primary/Operations.ts — wrapper formatting, safer spreads, and centralization via wrapAbstractOperations.
    • src/ops/allAction.ts, src/ops/action.ts — signature simplification and return-value changes.
    • src/Options.ts — updated ActionMethod/AllActionMethod types to remove affected-item tuple variants.
  • Tests

    • Added: tests/Library.test.ts, tests/examples/enterprise-example.test.ts, tests/examples/library-architecture-example.test.ts, tests/examples/multi-level-keys.test.ts, tests/examples/simple-example.test.ts
    • Updated: many files under tests/ops/* and tests/contained/* to remove eslint-disable inline comments and to adjust expectations to explicit undefined arguments and simplified returns.
  • Configuration

    • eslint.config.mjs — removed test-specific override that relaxed the no-undefined rule.
    • package.json — removed duplicate version lines, removed precommit script, bumped dependency ranges, and adjusted devDependencies.
    • package-lock.json — synchronized with the new dependency versions.
    • .github/workflows/npm-publish.yml — removed the build job dependency for publish.
    • vitest.config.ts — removed duplicate branch coverage threshold entries to avoid conflicting values.

Why these changes were made

  • Enforcing consistent lint rules across tests and source removes a category of divergences where tests could silently permit patterns not allowed in source code (for example accidental usage of undefined), improving long-term code health.
  • Simplifying action/allAction APIs reduces complexity in option signatures and caller code by removing the affected-items tuple plumbing that was rarely necessary and made callers and tests more intricate.
  • Centralizing mocks and adding small example tests improves test clarity and provides light-weight checks that example modules export expected functions and can be invoked safely without executing heavy example logic.
  • Removing expensive local precommit hooks and simplifying CI job dependencies reduces developer friction while leaving hooks and validations available for CI or optional local tooling.
  • Bumping runtime and linting dependencies keeps the project aligned with the rest of the Fjell packages and ensures tooling supports required lint rules and language features.

If you maintain code that calls action/allAction methods or relies on the older tuple return shape, update callers and tests to expect the single direct return value. If tests previously relied on runtime-lax behavior for undefined, update tests to explicitly pass undefined or refactor to avoid relying on undefined-sensitive behavior.

For developers running the project locally: after pulling this release, run a fresh install (npm ci or equivalent) to ensure the updated lockfile metadata and bumped devDependencies are applied.


Changelog summary (selected):

  • Remove test-specific ESLint override and inline eslint-disable usages; enforce consistent rules across tests.
  • Delete package.json precommit script and remove duplicate/hard-coded version entries.
  • Add a focused library test suite and multiple example tests; centralize module mocks.
  • Simplify action/allAction APIs to return direct values; update wrappers and tests accordingly.
  • Make operations wrapper spreads safe against undefined and tidy wrapper implementations.
  • Bump @fjell/core, @fjell/logging, @fjell/registry runtime versions and ESLint tooling; update package-lock.json to match.
  • Remove redundant coverage threshold entries and simplify GitHub Actions workflow dependencies.