-
Notifications
You must be signed in to change notification settings - Fork 27
[WIP] Testing: Comprehensive test coverage for weAudit #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
fegge
wants to merge
19
commits into
main
Choose a base branch
from
testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Document the comprehensive test strategy for the weAudit extension including: - Test framework and tools (mocha, chai, sinon, nyc) - Four-phase testing approach (P0-P2 priority) - 173 planned tests across data integrity, entry lifecycle, workspace management, and UI components - VS Code API mocking strategies - CI requirements and conventions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Set up foundational test infrastructure for weAudit extension: - Add devDependencies: jsdom, nyc, @vscode/test-electron, proxyquire - Create test directory structure (unit/, mocks/, fixtures/) - Add VS Code API mock factories (12 factories for Uri, WorkspaceFolder, TextEditor, ExtensionContext, Range, Selection, TextDocument, etc.) - Add fixture .weaudit files for testing (valid, minimal, legacy, corrupt, empty, invalid-entry-type, missing-fields) - Configure nyc for coverage reporting (60% threshold) - Add npm scripts: test, test:unit, test:ext, coverage - Add tests for mock factories and fixture validation 52 tests passing Closes #95 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix prettier formatting in .nycrc.json - Add husky pre-commit hook to run ESLint and Prettier checks - Ensures code style consistency before commits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Phase 1 - Data Integrity (#96): - validators.test.ts: 54 tests for validateSerializedData - persistence.test.ts: 22 tests for file load/save operations - types.test.ts: Extended with comprehensive type guards, equality, merging, and factory function tests Phase 2 - Entry Lifecycle (#97): - entryCrud.test.ts: 32 tests for entry creation, deletion, resolution - locations.test.ts: 42 tests for location management and selection - auditing.test.ts: 42 tests for file auditing and partial audits Total: 311 tests passing Closes #96, Closes #97 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Phase 3 - Workspace & Navigation (#98): - multiRoot.test.ts: 35 tests for workspace root management, unique label generation, and path resolution - permalinks.test.ts: 44 tests for GitHub/GitLab/Bitbucket permalink generation, SSH URL handling, and line formatting - navigation.test.ts: 32 tests for partially audited region navigation, wrapping, and multi-root traversal Total: 398 tests passing Closes #98 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Phase 4 - UI Components (#99): - treeProviders.test.ts: 65 tests for main tree provider, MultipleSavedFindingsTree, and ResolvedEntriesTree - messageHandlers.test.ts: 27 tests for webview message handling including update-entry, update-repository-config, choose-workspace-root - decorations.test.ts: 36 tests for DecorationManager including color configuration, hoverOnLabel, and labelAfterFirstLineTextDecoration Total: 487 tests passing Closes #99 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add test.yml workflow with unit tests, extension tests, and build jobs - Configure VS Code version matrix (stable + insiders on Ubuntu) - Configure OS matrix (ubuntu, macos, windows) - Add Codecov integration for coverage reporting - Add .vscode-test.mjs configuration for extension host tests - Add Tests and Codecov badges to README Closes #100 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document 75 planned extension integration tests covering: - Extension activation and command registration - Command execution (addFinding, toggleAudited, copyPermalink, etc.) - Tree view integration and drag-and-drop - Editor decorations and gutter icons - Webview panels (finding details, git config) - Workspace operations (single/multi-root, file watchers) - File decorations in explorer - Error handling and performance requirements Also includes test runner configuration examples and sample test file. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace TreeViewMode.PerFile with TreeViewMode.GroupByFile to match the actual enum definition in src/types.ts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Refactor extension tests to remove invalid/always-passing tests - Remove ~33 tests that used `|| true` patterns or try/catch blocks that always passed regardless of outcome - Fix misleading test names in performance tests - Update CI workflow to test against both stable and insiders VS Code - Add unit tests to pre-commit hook (eslint + prettier + unit tests) Test matrix now covers: - 3 platforms (ubuntu, macos, windows) - 2 VS Code versions (stable required, insiders allowed to fail) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix unsafe non-null assertions by properly handling undefined activeTextEditor in getActiveSelectionLocation and related methods - Add eslint-disable comments with justifications for necessary non-null assertions - Refactor extension tests to verify actual behavior (persisted data) instead of only checking command execution success - Remove redundant unit tests superseded by integration tests - Update pre-commit hook to fail on ESLint warnings - Add pretest:ext script to ensure compilation before extension tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix configuration property tests to handle package.json configuration as an array of sections instead of a single object - Fix toggleTreeViewMode test to get fresh config object after toggle - Fix performance test to create .vscode directory if it doesn't exist - Fix addPartiallyAudited test to use non-zero end character to prevent line decrement behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pin codecov/codecov-action to commit hash instead of version tag to address CodeQL warning about unpinned 3rd party actions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix state sharing between tests by adding suiteTeardown cleanup - Restore original weaudit file content after tests complete - Fix addPartiallyAudited test to handle file already being fully audited - Replace showInputBox mocking (doesn't work across extension host) with VS Code commands (acceptSelectedQuickOpenItem, closeQuickOpen) - Improve showMarkedFilesDayLog test to verify actual document content - All tests now have meaningful assertions that can fail 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace fixed setTimeout delays with a polling mechanism that waits for expected state changes. This resolves intermittent test failures in CI where 500ms delays were insufficient for VS Code operations to complete. - Add waitForCondition helper to poll for state changes with timeout - Update toggleAudited test to poll until audit state changes - Update addPartiallyAudited test to poll for state changes - Update showMarkedFilesDayLog test to poll for editor visibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The extension uses path.relative() which returns OS-native separators. On Windows this produces backslashes (src\sample.ts) while the tests were hardcoding forward slashes (src/sample.ts), causing path comparison failures in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces comprehensive test coverage for the weAudit VS Code extension.
Testing Plan
See
TESTING.mdfor the full testing strategy covering:types.ts, 60% overallRelated Issues
This work is tracked in the Test Coverage v1.0 milestone:
Progress
Current status: 487 unit tests passing, CI workflow active
Test plan
🤖 Generated with Claude Code