Skip to content

Improve dependency management and add integration tests for published package #61

Description

@thomaschaplin

Background

Following the resolution of issue #59 and PR #60, we identified several areas for improvement in our dependency management and testing strategy.

Issues Identified

1. Dependency Classification Bug

  • Problem: json-to-graphql-query was incorrectly placed in devDependencies instead of dependencies
  • Impact: Runtime errors for consumers using v2.0.2+ (Cannot find module 'json-to-graphql-query')
  • Root Cause: No automated testing of the published package in isolation

2. Testing Gap

  • Problem: Our current test suite runs against the local development environment where devDependencies are installed
  • Impact: Dependency classification bugs go undetected until users report them
  • Solution Needed: Integration tests that use the published package directly

Proposed Improvements

A. Short-term: Add Package Integration Tests

Create tests that validate the published package works correctly:

  1. Add npm pack/install test workflow:

    # In CI, test the actual published package
    npm pack
    cd test-integration
    npm install ../package-name-*.tgz
    npm test
  2. Create integration test directory (test-integration/):

    • Separate package.json with only production dependencies
    • Tests that import and use the published package
    • Focus on runtime dependency validation

B. Long-term: Evaluate EnumType Dependency

As suggested by @rickschubert in #59, consider whether the json-to-graphql-query dependency is necessary:

Option 1: Keep Current Approach ✅ (Recommended for now)

  • Maintains compatibility with json-to-graphql-query
  • Preserves the library's promise of being "the reverse of json-to-graphql-query"
  • Minimal maintenance overhead

Option 2: Remove EnumType Dependency (Future consideration)

  • Would eliminate the runtime dependency
  • Breaking change - requires major version bump
  • Need to define custom enum representation format
  • Loss of direct compatibility with json-to-graphql-query

Option 3: Make EnumType Optional

  • Allow users to opt-in to json-to-graphql-query compatibility
  • More complex API surface
  • Potential for confusion

C. Development Process Improvements

  1. Pre-release testing checklist:

    • Test packed package in isolation
    • Verify all runtime dependencies are in dependencies
    • Run integration tests against published package
  2. CI/CD enhancements:

    • Add workflow step to test packed package
    • Validate dependency classification automatically

Implementation Plan

Phase 1: Immediate (Next Release)

  • Add integration test suite that tests the packed package
  • Update CI to run integration tests
  • Document dependency testing process

Phase 2: Future Consideration (Major Version)

  • Evaluate community feedback on EnumType dependency
  • Consider API changes if there's demand for dependency elimination
  • Conduct impact analysis on existing users

References

Questions for Discussion

  1. Should we prioritize eliminating the json-to-graphql-query dependency in a future major version?
  2. What's the preferred approach for integration testing - separate directory or inline?
  3. Should we add automated dependency classification validation to prevent future issues?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions