Summary
The RunEasBuild command (src/extension/commands/runEasBuild.ts) has no unit test coverage. It contains conditional file-creation logic that is worth validating: it creates eas.json when absent, creates .eas/workflows/create-production-builds.yml when absent, and shows error messages on file-system permission failures. None of this logic is currently exercised by any test.
Why this is useful
Unit tests will catch regressions in the file-creation and permission-error paths without requiring a real EAS project, keeping CI reliable as the command evolves alongside the EAS workflow feature.
Suggested scope
- Mock the file system (
fs.existsSync, fs.writeFileSync, fs.mkdirSync) and vscode.window.showErrorMessage using proxyquire + Sinon, following the same pattern as launchAndroidEmulator.test.ts
- Test case: project root path is undefined → error message shown, no file created
- Test case:
eas.json already exists → file write skipped
- Test case:
eas.json missing → file created with {}
- Test case: workflow file already exists →
mkdirSync/writeFileSync skipped
- Test case: workflow file missing → directory and file created with expected YAML template
- Test case:
fs.writeFileSync throws (permission error) → error message shown
Evidence
Validation
- Run
npm test (or the mocha suite for test/extension/commands/) and confirm the new test file passes
- Confirm no regressions in the existing command test suite
Summary
The
RunEasBuildcommand (src/extension/commands/runEasBuild.ts) has no unit test coverage. It contains conditional file-creation logic that is worth validating: it createseas.jsonwhen absent, creates.eas/workflows/create-production-builds.ymlwhen absent, and shows error messages on file-system permission failures. None of this logic is currently exercised by any test.Why this is useful
Unit tests will catch regressions in the file-creation and permission-error paths without requiring a real EAS project, keeping CI reliable as the command evolves alongside the EAS workflow feature.
Suggested scope
fs.existsSync,fs.writeFileSync,fs.mkdirSync) andvscode.window.showErrorMessageusingproxyquire+ Sinon, following the same pattern aslaunchAndroidEmulator.test.tseas.jsonalready exists → file write skippedeas.jsonmissing → file created with{}mkdirSync/writeFileSyncskippedfs.writeFileSyncthrows (permission error) → error message shownEvidence
src/extension/commands/runEasBuild.tstest/extension/commands/0446243a,ea74c926,1af55735each add a focused test file for a single commandValidation
npm test(or the mocha suite fortest/extension/commands/) and confirm the new test file passes