🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Significantly improves the test suite by adding 24 new unit tests for the PHPCBF class (previously untested) and 6 edge-case tests for findFiles. Total test count grows from 7 → 36.
Changes
extension.js
- Exports
PHPCBF class (exports.PHPCBF = PHPCBF) so unit tests can instantiate it directly without requiring a VS Code Extension Host.
test/phpcbf.test.js (new)
Tests PHPCBF by injecting a lightweight vscode mock via Module._resolveFilename — no extension host required. Covers:
| Suite |
What's tested |
loadSettings |
Default values, config overrides, onsave, standard, debug, tilde (~) expansion in executablePath, re-load on config change |
getArgs |
-lq vs -l flag (debug mode), tmpFileName placement, --standard=(value) presence/absence, argument ordering |
getStandard |
configSearch: false pass-through, null workspace folder, phpcs.xml discovery, .phpcs.xml priority over phpcs.xml, fallback to this.standard, null standard |
test/unit.test.js
Six new edge-case tests for findFiles:
- Empty
names array → null
- Empty-string
directory (resolves to parent) → finds file / returns null
- Name-array priority: first match wins; falls through to second name when first absent
package.json
Updated test:unit script to run both test files: node --test test/unit.test.js test/phpcbf.test.js
Test Status
✔ PHPCBF.loadSettings (10 tests)
✔ PHPCBF.getArgs (7 tests)
✔ PHPCBF.getStandard (7 tests)
✔ findFiles (12 tests, up from 7)
tests 36 | pass 36 | fail 0
All tests pass with npm run test:unit.
Generated by Repo Assist · ◷
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f
To route changes like this to a review issue instead of blocking, configure protected-files: fallback-to-issue in your workflow configuration.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Significantly improves the test suite by adding 24 new unit tests for the
PHPCBFclass (previously untested) and 6 edge-case tests forfindFiles. Total test count grows from 7 → 36.Changes
extension.jsPHPCBFclass (exports.PHPCBF = PHPCBF) so unit tests can instantiate it directly without requiring a VS Code Extension Host.test/phpcbf.test.js(new)Tests
PHPCBFby injecting a lightweight vscode mock viaModule._resolveFilename— no extension host required. Covers:loadSettingsonsave,standard,debug, tilde (~) expansion inexecutablePath, re-load on config changegetArgs-lqvs-lflag (debug mode),tmpFileNameplacement,--standard=(value)presence/absence, argument orderinggetStandardconfigSearch: falsepass-through, null workspace folder,phpcs.xmldiscovery,.phpcs.xmlpriority overphpcs.xml, fallback tothis.standard, null standardtest/unit.test.jsSix new edge-case tests for
findFiles:namesarray →nulldirectory(resolves to parent) → finds file / returns nullpackage.jsonUpdated
test:unitscript to run both test files:node --test test/unit.test.js test/phpcbf.test.jsTest Status
All tests pass with
npm run test:unit.Warning
🛡️ Protected Files
This was originally intended as a pull request, but the patch modifies protected files:
package.json.These files may affect project dependencies, CI/CD pipelines, or agent behaviour. Please review the changes carefully before creating the pull request.
Click here to create the pull request once you have reviewed the changes
To route changes like this to a review issue instead of blocking, configure
protected-files: fallback-to-issuein your workflow configuration.