- Notifications
You must be signed in to change notification settings - Fork24
WIP bulk refactor - tests, factories, mocks, oh my#541
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
jaggederest wants to merge63 commits intomainChoose a base branch fromjaggederest/refactor_extension
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.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes fromall commits
Commits
Show all changes
63 commits Select commitHold shift + click to select a range
7e1bce9
pretest working
jaggederestc693a46
enable vscode-test and bump tsconfig to modern settings
jaggederest240b649
Merge branch 'main' into jaggederest/integration_tests
jaggederest0e58a31
test: fix integration tests to run without Remote SSH extension
jaggederest872b7e8
Merge remote-tracking branch 'origin/jaggederest/integration_tests' i…
jaggederest01c2d80
autocorrect formatting
jaggederest8ddbf26
bump node version to 22
jaggederest9b74df4
fix: configure Vitest to properly exclude VS Code integration tests
jaggederestadec211
whitespace
jaggederestd9b543a
fix: update tsconfig.json and convert pretty-bytes imports to standar…
jaggederesta7afdd6
Remove testmode flag in favor of checking existence of remote ssh ext…
jaggederest3097d8f
remove superfluous async, enable lint rule
jaggederesta2d2bc8
fix: resolve ESLint @typescript-eslint/require-await errors
jaggederest32dfda4
Update configurations and remove pointless Promise.all
jaggederest12b0124
Tweak eslint config to better handle json/md, remove compile-tests sc…
jaggederestcf58040
feat: expand integration tests and add coverage analysis
jaggederest1be94c3
fix: update integration tests to match actual commands
jaggederest67c47e0
feat: switch to VS Code built-in coverage for integration tests
jaggederest62c88f4
feat: add comprehensive integration test framework
jaggederest907347e
feat: implement comprehensive integration tests for CLI, URI handler,…
jaggederest7563580
feat: add comprehensive unit test coverage for all source files
jaggederest379b9ee
fix: resolve all broken unit tests with proper vscode and API mocking
jaggederestf2863b5
feat: enhance api.ts test coverage to 95.52%
jaggederestced86e9
feat: achieve 48.4% overall test coverage with incremental improvements
jaggederest1dbee30
docs: update TODO.md and CLAUDE.md to reflect test coverage progress
jaggederest6d93e76
test: add unit tests for commands.ts - improved coverage from 28% to …
jaggederest2471b72
test: improve unit test coverage from 48.4% to 60.11%
jaggederest3e38dca
test: improve remote.ts coverage from 32.61% to 49.21%
jaggederest797b656
test: improve test coverage for commands, storage, and workspacesProv…
jaggederest8f150cb
feat: add structured logging foundation with TDD approach
jaggederest07bffb8
docs: update TODO.md with testing synthesis and logging plan
jaggederestfe296b2
feat: integrate logger into Storage class with TDD approach
jaggederest32b4df0
refactor: create type-safe mock builders and clean up api-helper.test.ts
jaggederestbfd4b34
refactor: clean up type casting in test files
jaggederestd4af4ed
fix: update test-helpers to use proper Storage type
jaggederest6c947fe
docs: update TODO.md with test quality improvement progress
jaggederestf8b6dbb
test: add Logger factory and verify backward compatibility
jaggederesta57d676
fix: address ESLint errors in api.test.ts
jaggederest97ff5fb
docs: simplify TODO.md and update progress
jaggederest8021706
docs: update CLAUDE.md with TDD patterns and techniques from session
jaggederestb624614
feat: integrate Logger into remote.ts with TDD approach
jaggederest2629397
feat: integrate Logger into extension.ts with initialization
jaggederest53272c1
test: add Logger integration tests for headers.ts
jaggederest92c548a
test: add Logger integration tests for workspaceMonitor
jaggederest9e8ed6d
test: add Logger integration tests for inbox
jaggederest3595bda
docs: update TODO.md with Logger integration progress
jaggederest9aac82d
test: add Logger integration tests for error.ts
jaggederest341cc67
test: add Logger integration tests for workspacesProvider
jaggederestdfd55e1
test: add Logger integration tests for commands.ts
jaggederest6285043
docs: mark Logger integration as complete in TODO.md
jaggederesteca919f
refactor: extract helper functions from monolithic activate() in exte…
jaggederest8505c4f
refactor: complete TDD extraction of all functions from activate()
jaggederest8b8edc7
test: consolidate test mocks into reusable factories
jaggederest1a43dd3
docs: update TODO.md and CLAUDE.md with test improvements
jaggederesta1af9cb
test: improve integration tests from 86 to 100 passing
jaggederesteaee610
test: clean up pointless integration tests and enable 3 more
jaggederestc4a2156
test: remove 9 more pointless integration tests
jaggederest1a9f34f
test: remove all skipped integration tests for fresh start
jaggederest6291f7f
refactor: improve testability through dependency injection and test s…
jaggederesta72e943
test: remove flaky UI tests and improve test stability
jaggederesteb787f8
test: simplify test files and reduce verbosity
jaggederestfa1f576
test: reduce test verbosity by 41% while maintaining 84% coverage
jaggederestc73c742
test: simplify test suite by removing low-value tests
jaggederestFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Binary file added.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions.eslintignore
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vitest.config.ts |
15 changes: 14 additions & 1 deletion.eslintrc.json
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
4 changes: 2 additions & 2 deletions.github/workflows/ci.yaml
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
2 changes: 1 addition & 1 deletion.github/workflows/release.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -18,7 +18,7 @@ jobs: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "22" | ||
- run: yarn | ||
12 changes: 12 additions & 0 deletions.vscode-test.mjs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from "@vscode/test-cli"; | ||
export default defineConfig({ | ||
files: "out/test/**/*.test.js", | ||
extensionDevelopmentPath: ".", | ||
extensionTestsPath: "./out/test", | ||
launchArgs: ["--enable-proposed-api", "coder.coder-remote"], | ||
mocha: { | ||
ui: "tdd", | ||
timeout: 20000, | ||
}, | ||
}); |
2 changes: 1 addition & 1 deletion.vscodeignore
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -12,4 +12,4 @@ node_modules/** | ||
**/.editorconfig | ||
**/*.map | ||
**/*.ts | ||
*.gif |
52 changes: 28 additions & 24 deletionsCLAUDE.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
# Coder Extension Development Guidelines | ||
## Core Philosophy | ||
**First-Principles + KISS**: Question every assumption aggressively, then build the simplest solution from fundamental truths. If there's a straight line, take it, otherwise ask questions and gather any information necessary to determine the right path forward. | ||
## Commands | ||
```bash | ||
yarn lint:fix # Lint with auto-fix | ||
yarn test:ci --coverage # Run ALL unit tests (ALWAYS use this) | ||
yarn pretest && yarn test:integration # Integration tests | ||
``` | ||
## Key Rules | ||
- **TypeScript strict mode**, no semicolons, 120 char lines | ||
- **Test files**: `*.test.ts` (Vitest for unit, VS Code API for integration) | ||
- **Use test-helpers.ts**: 30+ mock factories available - NEVER create inline mocks, instead create a new factory in that file and import it | ||
- **TDD always**: Write test → implement → refactor | ||
- **Never use any**: Always try to use at least a decently close Partial type or equivalent | ||
- **Never delete tests**: Only delete or skip tests if directly asked, otherwise ask the user for help if fixing the tests does not work. | ||
## Testing Approach | ||
1. Use `yarn test:ci --coverage` before and after EVERY change | ||
2. Import factories and mocks from test-helpers.ts (createMock* and *Factory) | ||
3. Write a test, make sure it fails, and only then make it pass | ||
4. Use proper types, NEVER use eslint-disable to make mocks work | ||
5. If mocking is too complicated, consider whether the function under test needs a minor refactoring that passes existing tests first, to make it easier to test. |
49 changes: 49 additions & 0 deletionsCOVERAGE.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Test Coverage Impact Analysis | ||
Baseline coverage: 83.78% | ||
## Test File Impact | ||
| Test File | Coverage Without File | Coverage Delta | Impact | | ||
| -------------------------- | --------------------- | -------------- | -------- | | ||
| api-helper.test.ts | 83.28% | -0.50% | Low | | ||
| api.test.ts | 78.59% | -5.19% | High | | ||
| cliManager.test.ts | 81.58% | -2.20% | Medium | | ||
| commands.test.ts | 88.12% | +4.34% | Negative | | ||
| error.test.ts | 81.53% | -2.25% | Medium | | ||
| extension.test.ts | 82.75% | -1.03% | Low | | ||
| featureSet.test.ts | 83.66% | -0.12% | Minimal | | ||
| headers.test.ts | 82.06% | -1.72% | Low | | ||
| inbox.test.ts | 83.69% | -0.09% | Minimal | | ||
| logger.test.ts | 83.08% | -0.70% | Low | | ||
| proxy.test.ts | 82.10% | -1.68% | Low | | ||
| sshConfig.test.ts | 82.94% | -0.84% | Low | | ||
| sshSupport.test.ts | 83.44% | -0.34% | Minimal | | ||
| storage.test.ts | 85.80% | +2.02% | Negative | | ||
| util.test.ts | 82.12% | -1.66% | Low | | ||
| workspaceMonitor.test.ts | 83.34% | -0.44% | Low | | ||
| workspacesProvider.test.ts | 83.92% | +0.14% | Negative | | ||
## Summary | ||
### High Impact Files (>2% coverage drop): | ||
- **api.test.ts**: -5.19% (critical for API coverage) | ||
- **error.test.ts**: -2.25% | ||
- **cliManager.test.ts**: -2.20% | ||
### Negative Impact Files (coverage increases without them): | ||
- **commands.test.ts**: +4.34% (commands.ts has low coverage at 62.61%) | ||
- **storage.test.ts**: +2.02% (storage.ts has low coverage at 71.01%) | ||
- **workspacesProvider.test.ts**: +0.14% | ||
### Low Impact Files (<2% coverage drop): | ||
- Most other test files have minimal impact on overall coverage | ||
### Recommendations: | ||
1. Keep all High Impact files | ||
2. Consider removing or significantly reducing tests in Negative Impact files | ||
3. Low Impact files are candidates for test reduction based on test quality/value |
49 changes: 49 additions & 0 deletionsTODO.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# VSCode Coder Extension - Remaining Work | ||
## Current Status | ||
- **405 unit tests** (78.49% coverage) | ||
- **69 integration tests** passing | ||
- **1 file** <50% coverage (remote.ts) | ||
## Major Initiatives | ||
### 1. Refactor Monolithic Methods | ||
- [ ] **remote.ts** (49.51% → 80%+) - Break down 366-line setup() method | ||
- [ ] **commands.ts** (68.03% → 80%+) - Create UI abstraction layer | ||
### 2. Connection Reliability | ||
- [ ] Implement exponential backoff for retries | ||
- [ ] Add connection health monitoring | ||
- [ ] Create API/CLI abstraction layer | ||
- [ ] Migrate to CLI-first approach | ||
### 3. Enable Integration Tests (84 remaining) | ||
- [ ] Authentication (24 tests) | ||
- [ ] Workspace Operations (23 tests) | ||
- [ ] Tree Views (21 tests) | ||
- [ ] Remote Connection (36 tests) | ||
### 4. Test Infrastructure | ||
- [ ] Add SSH/Process/FileSystem mocks to test-helpers | ||
- [ ] Create integration test helpers | ||
- [ ] Implement testing patterns (State Machine, Command) | ||
## Success Metrics | ||
| Metric | Current | Target | | ||
| ------------------- | ------- | ------ | | ||
| Unit coverage | 78.49% | 85%+ | | ||
| Integration tests | 69 | 150+ | | ||
| Avg method length | >100 | <50 | | ||
| Files <50% coverage | 1 | 0 | | ||
## Next Steps | ||
1. Extract methods from remote.ts using TDD | ||
2. Create UIProvider interface for commands.ts | ||
3. Enable first batch of integration tests |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.