Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Implements test infrastructure from scratch for the react-obj-view library, addressing the complete absence of automated testing, and ensures compatibility with modern Node.js and Yarn versions.

Testing Framework

  • Vitest with React support and happy-dom environment
  • Test scripts: test, test:watch, test:ui, test:coverage
  • Coverage reporting with v8 provider

Test Coverage (230 tests, 12 files)

Utilities (26 tests)

  • joinClasses: class name concatenation, falsy filtering
  • object: property access, getters, error handling
  • groupedProxy: factory creation, caching, equality checks

Core Engine (116 tests)

  • CircularChecking: circular reference detection with WeakSet, LIFO stack management, deep nesting support
  • StateFactory: state creation and caching, child state management, nested hierarchies, read-only access
  • getObjectUniqueId: unique ID generation with WeakMap, object identity tracking, performance tested with 1000+ objects
  • walkingToIndexFactory: tree walking and indexing, node expansion/collapse, circular reference handling during traversal, state caching, path navigation

Resolvers (40 tests)

  • collections: Map/Set/Iterator resolvers in preview and normal modes
  • promise: promise status tracking, InternalPromise wrapper
  • LazyValueWrapper: instance caching, initialization, getter evaluation

Components (26 tests)

  • ObjectView rendering: primitives, objects, arrays, special types (Map, Set, Date, RegExp, Error, Promise)
  • Props validation: expandLevel, className, style, lineHeight, preview, showLineNumbers
  • Large datasets with grouping (arrayGroupSize, objectGroupSize)

Integration (22 tests)

  • Circular references (simple, nested, array, mutual)
  • Complex nested structures with mixed collections
  • Performance: 10K+ item arrays/objects
  • Edge cases: typed arrays, frozen objects, sparse arrays, special numbers (Infinity, NaN)

Node.js & Yarn Compatibility

  • Node.js: 22.x and 24.x support with .nvmrc file
  • Yarn: 4.x compatibility (configured via packageManager field)
  • Engines: Added engines field in package.json requiring Node >=22.0.0 and Yarn >=4.0.0

CI/CD

  • New CI Workflow: .github/workflows/ci.yml tests against both Node 22.x and 24.x using Yarn 4
  • Updated Deploy Workflow: Uses Node 22 for GitHub Pages deployment
  • Security: Explicit permissions set for GitHub Actions workflows

Documentation

  • TESTING.md: framework overview, test patterns, debugging, CI/CD integration, prerequisites and setup instructions
  • Updated README.md with testing section and system requirements
Original prompt

planning test for this repository and apply it step by step


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 11, 2025 18:14
Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Copilot AI changed the title [WIP] Plan and implement tests for repository Add comprehensive test infrastructure with 114 tests covering utilities, resolvers, and components Nov 11, 2025
Copilot AI requested a review from vothanhdat November 11, 2025 18:25
Copy link
Owner

@vothanhdat vothanhdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about walkingToIndexFactory and StateFactory @copilot

…gToIndexFactory, getObjectUniqueId)

Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

how about walkingToIndexFactory and StateFactory @copilot

Added comprehensive tests for both modules in commit 8396c0b:

walkingToIndexFactory (40 tests):

  • Tree walking and indexing logic
  • Node expansion/collapse
  • Circular reference handling during traversal
  • State caching and updates
  • Path navigation and node retrieval

StateFactory (19 tests):

  • State creation and caching
  • Child state management
  • Nested hierarchies
  • Read-only access patterns

Also added tests for supporting modules:

  • CircularChecking (27 tests): Reference detection and stack management
  • getObjectUniqueId (30 tests): Unique ID generation with WeakMap

Total: 230 tests now passing (up from 114).

Copilot AI changed the title Add comprehensive test infrastructure with 114 tests covering utilities, resolvers, and components Add comprehensive test infrastructure with 230 tests covering utilities, resolvers, core engine, and components Nov 11, 2025
Copilot AI requested a review from vothanhdat November 11, 2025 18:44
vothanhdat

This comment was marked as duplicate.

Copy link
Owner

@vothanhdat vothanhdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot how about yarn v4, node 22, node 24.

Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot how about yarn v4, node 22, node 24.

Compatibility added in commit 98fdbfe:

  • .nvmrc for local development (Node 22)
  • engines in package.json (Node >=22.0.0, Yarn >=4.0.0)
  • CI workflow matrix testing Node 22.x and 24.x
  • Yarn 4 enabled via Corepack in CI
  • Updated README and TESTING.md with prerequisites

All tests and build verified working.

Make it compatible vs yarn v4, node 22, node 24 @copilot

Added full compatibility in commit 98fdbfe:

Node.js Support:

  • .nvmrc file specifying Node 22
  • engines field in package.json requiring Node >=22.0.0
  • CI workflow testing both Node 22.x and 24.x

Yarn v4:

  • Already configured via packageManager field
  • CI uses Corepack to enable Yarn 4
  • Updated documentation with setup instructions

CI/CD:

  • New .github/workflows/ci.yml runs tests on both Node versions
  • Updated deploy workflow to use Node 22
  • All 230 tests passing

Co-authored-by: vothanhdat <8221386+vothanhdat@users.noreply.github.com>
Copilot AI changed the title Add comprehensive test infrastructure with 230 tests covering utilities, resolvers, core engine, and components Add comprehensive test infrastructure with 230 tests and Node 22/24 + Yarn v4 compatibility Nov 12, 2025
Copilot AI requested a review from vothanhdat November 12, 2025 01:18
@vothanhdat vothanhdat marked this pull request as ready for review November 12, 2025 01:54
@vothanhdat vothanhdat merged commit 0b30682 into master Nov 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants