Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@
"indent": "off",
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/extensions": "off",
"consistent-return": "off",
"no-restricted-syntax": "off",
"max-len":"off",
"no-tabs": "off",
"no-use-before-define": "off"
}
},
"overrides": [
{
"files": ["src/test/**/*.ts"],
"env": {
"mocha": true
},
"rules": {
"no-promise-executor-return": "off"
}
}
]
}
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
test:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
name: Linter
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -30,3 +30,9 @@ jobs:

- name: Run the build
run: npm run build

- name: Run tests
run: xvfb-run -a npm test

- name: Run mutation testing
run: npm run test:mutation
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
.vscode-test/
*.vsix
/out
.stryker-tmp/
reports/
6 changes: 6 additions & 0 deletions .mocharc.unit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"spec": "out/test/unit/**/*.test.js",
"ui": "tdd",
"timeout": 5000,
"color": true
}
11 changes: 11 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/suite/**/*.test.js',
version: 'stable',
launchArgs: ['--disable-extensions'],
mocha: {
ui: 'tdd',
timeout: 20000
}
});
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/.vscode/sample.php"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: build"
}
Expand Down
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
**/*.ts
images/screenshot*
src/**
out/test/**
test/**
.vscode-test.mjs
tsconfig.json
22 changes: 21 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,26 @@ You can clone this repo and then run the extension in development mode in VS Cod

2. Open the directory in VS Code and launch the extension from the `Run` panel.

The extension source code can be found in `src/extension.ts`.
The extension source code is in the `src/` directory with the following structure:
- `src/extension.ts` - Entry point
- `src/providers/` - Completion and hover providers
- `src/utils/` - Helper functions for hooks, types, and matchers
- `src/generators/` - Code generation for docblocks and snippets
- `src/types/` - TypeScript interfaces

### Running Tests

Run the test suite:

```bash
npm test
```

This runs all tests in a headless VS Code instance. Tests are located in `src/test/suite/` and cover:
- Hook completion (actions and filters)
- Callback completion (closures, arrow functions, utility functions)
- Hover provider functionality
- Edge cases and various hook functions

## Releasing a New Version

Expand All @@ -31,6 +50,7 @@ These are the steps to take to release a new version of the extension (for contr
### Prior to Release

1. Check [the milestone on GitHub](https://github.com/wp-hooks/vscode-wordpress-hooks/milestones) for open issues or PRs. Fix or reassign as necessary.
1. Run `npm test` to ensure all tests pass.
1. Ensure `readme.md` contains an up to date description, FAQs, screenshots, etc.
1. Ensure `.vscodeignore` is up to date with all files that shouldn't be part of the build.
1. Prepare a changelog for [the Releases page on GitHub](https://github.com/wp-hooks/vscode-wordpress-hooks/releases).
Expand Down
Loading
Loading