Skip to content

Commit 7a4996c

Browse files
feat: Add testing infrastructure and documentation
- Set up Vitest for unit testing with jsdom - Add test setup with Web Audio API and requestAnimationFrame mocks - Create initial test suites for DOM and animations modules - Add test scripts to package.json (test, test:ui, test:run, coverage) - Update CI workflow to include test execution - Create CONTRIBUTING.md with conventional commits guidelines - Create SECURITY.md with security policy - Update ESLint config to support test files - All tests passing (8/8) Co-authored-by: ZaneThePython <102631678+ZaneThePython@users.noreply.github.com>
1 parent 542d808 commit 7a4996c

10 files changed

Lines changed: 1426 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
lint-and-build:
10+
lint-test-build:
1111
runs-on: ubuntu-latest
1212

1313
strategy:
@@ -33,6 +33,9 @@ jobs:
3333
- name: Check formatting
3434
run: npm run format:check
3535

36+
- name: Run tests
37+
run: npm run test:run
38+
3639
- name: Build project
3740
run: npm run build
3841

CONTRIBUTING.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Contributing to ZanePersonal
2+
3+
Thank you for your interest in contributing to this project! While this is primarily a personal website, contributions are welcome.
4+
5+
## Commit Message Format
6+
7+
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.
8+
9+
### Format
10+
11+
```
12+
<type>(<scope>): <subject>
13+
14+
<body>
15+
16+
<footer>
17+
```
18+
19+
### Types
20+
21+
- **feat**: A new feature
22+
- **fix**: A bug fix
23+
- **docs**: Documentation changes
24+
- **style**: Code style changes (formatting, missing semi-colons, etc.)
25+
- **refactor**: Code refactoring without changing functionality
26+
- **perf**: Performance improvements
27+
- **test**: Adding or updating tests
28+
- **build**: Changes to build system or dependencies
29+
- **ci**: Changes to CI configuration
30+
- **chore**: Other changes that don't modify src or test files
31+
32+
### Examples
33+
34+
```
35+
feat(effects): add new particle collision detection
36+
37+
fix(animations): resolve timing issue with typewriter effect
38+
39+
docs(readme): update installation instructions
40+
41+
style(css): apply consistent naming convention
42+
43+
refactor(modules): extract sound utilities to separate module
44+
45+
perf(effects): optimize particle rendering loop
46+
47+
test(interactions): add unit tests for ripple effect
48+
49+
build(vite): update build configuration for better tree-shaking
50+
51+
ci(github-actions): add accessibility testing workflow
52+
```
53+
54+
## Development Workflow
55+
56+
1. **Fork the repository** (if you're an external contributor)
57+
58+
2. **Clone your fork**
59+
```bash
60+
git clone https://github.com/YOUR_USERNAME/ZanePersonal.git
61+
cd ZanePersonal
62+
```
63+
64+
3. **Install dependencies**
65+
```bash
66+
npm install
67+
```
68+
69+
4. **Create a feature branch**
70+
```bash
71+
git checkout -b feat/your-feature-name
72+
```
73+
74+
5. **Make your changes**
75+
- Write clean, readable code
76+
- Follow existing code style
77+
- Add comments where necessary
78+
- Update documentation if needed
79+
80+
6. **Run quality checks**
81+
```bash
82+
npm run lint # Check for linting errors
83+
npm run format # Format code with Prettier
84+
npm run build # Ensure project builds successfully
85+
```
86+
87+
7. **Commit your changes**
88+
```bash
89+
git add .
90+
git commit -m "feat(scope): your descriptive message"
91+
```
92+
93+
8. **Push to your fork**
94+
```bash
95+
git push origin feat/your-feature-name
96+
```
97+
98+
9. **Create a Pull Request**
99+
- Provide a clear description of changes
100+
- Reference any related issues
101+
- Ensure CI checks pass
102+
103+
## Code Style Guidelines
104+
105+
### JavaScript
106+
107+
- Use ES6+ features
108+
- Prefer `const` over `let`, avoid `var`
109+
- Use arrow functions for callbacks
110+
- Keep functions small and focused
111+
- Add JSDoc comments for complex functions
112+
- Follow the existing modular structure
113+
114+
### CSS
115+
116+
- Use CSS custom properties (variables) defined in `:root`
117+
- Follow BEM-like naming conventions where appropriate
118+
- Group related properties together
119+
- Use meaningful class names
120+
- Avoid overly specific selectors
121+
122+
### HTML
123+
124+
- Use semantic HTML5 elements
125+
- Include proper ARIA labels for accessibility
126+
- Ensure all images have alt text
127+
- Maintain proper heading hierarchy
128+
129+
## Testing
130+
131+
While this project doesn't currently have automated tests, please ensure:
132+
- All features work in modern browsers (Chrome, Firefox, Safari, Edge)
133+
- Responsive design works on mobile, tablet, and desktop
134+
- No console errors or warnings
135+
- Accessibility features work with keyboard navigation
136+
137+
## Performance Considerations
138+
139+
- Keep total bundle size under 150KB (compressed)
140+
- Optimize images before adding them
141+
- Minimize use of heavy libraries
142+
- Test animations on lower-end devices
143+
- Use lazy loading where appropriate
144+
145+
## Accessibility Standards
146+
147+
- Maintain WCAG 2.1 Level AA compliance
148+
- Test with screen readers
149+
- Ensure keyboard navigation works
150+
- Provide sufficient color contrast
151+
- Include focus indicators on interactive elements
152+
153+
## Pull Request Checklist
154+
155+
Before submitting a PR, ensure:
156+
157+
- [ ] Code follows the project's style guidelines
158+
- [ ] All linting checks pass (`npm run lint`)
159+
- [ ] Code is properly formatted (`npm run format`)
160+
- [ ] Project builds successfully (`npm run build`)
161+
- [ ] Changes are tested in multiple browsers
162+
- [ ] Documentation is updated if needed
163+
- [ ] Commit messages follow conventional commits format
164+
- [ ] PR description clearly explains the changes
165+
166+
## Questions or Issues?
167+
168+
Feel free to:
169+
- Open an issue for bugs or feature requests
170+
- Start a discussion for questions
171+
- Email [contact@zane.org](mailto:contact@zane.org)
172+
173+
## License
174+
175+
By contributing, you agree that your contributions will be licensed under the MIT License.
176+
177+
---
178+
179+
Thank you for contributing! 🎉

SECURITY.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
This is a personal website project. The latest version on the `main` branch is always supported.
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| Latest | :white_check_mark: |
10+
| Older | :x: |
11+
12+
## Reporting a Vulnerability
13+
14+
If you discover a security vulnerability in this project, please report it responsibly:
15+
16+
### Email
17+
Send details to [contact@zane.org](mailto:contact@zane.org) with:
18+
- Description of the vulnerability
19+
- Steps to reproduce
20+
- Potential impact
21+
- Suggested fix (if any)
22+
23+
### What to Expect
24+
- **Response time**: Within 48 hours
25+
- **Updates**: Regular communication about the issue
26+
- **Fix timeline**: Depends on severity and complexity
27+
- **Disclosure**: Coordinated disclosure after fix is deployed
28+
29+
### Please Do Not
30+
- Create public issues for security vulnerabilities
31+
- Exploit vulnerabilities beyond proof-of-concept
32+
- Access data that doesn't belong to you
33+
- Perform DoS attacks
34+
35+
## Security Measures
36+
37+
This project implements several security best practices:
38+
39+
### Code Security
40+
- **Input Sanitization**: All user inputs are sanitized (minimal as site is static)
41+
- **Dependencies**: Regular security audits via `npm audit`
42+
- **Linting**: ESLint configured to catch common security issues
43+
- **CSP Ready**: Content Security Policy headers can be added by hosting provider
44+
45+
### Build Security
46+
- **Dependency Scanning**: GitHub Dependabot enabled
47+
- **Automated Updates**: Security patches applied automatically
48+
- **CI/CD**: All code passes linting and build checks
49+
50+
### Best Practices
51+
- No sensitive data in repository
52+
- No API keys or credentials in code
53+
- HTTPS enforced on live site
54+
- Regular dependency updates
55+
- Minimal external dependencies
56+
57+
## Known Limitations
58+
59+
As a static personal website:
60+
- No backend or database
61+
- No user authentication
62+
- No data collection or storage
63+
- Minimal attack surface
64+
65+
## Security Updates
66+
67+
Security fixes are released as soon as possible after discovery. Check the [CHANGELOG](CHANGELOG.md) for security-related updates.
68+
69+
---
70+
71+
*Last updated: November 2024*

eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default [
2222
setTimeout: 'readonly',
2323
setInterval: 'readonly',
2424
clearInterval: 'readonly',
25+
clearTimeout: 'readonly',
2526
IntersectionObserver: 'readonly',
2627
__dirname: 'readonly',
2728
},
@@ -33,6 +34,19 @@ export default [
3334
'no-var': 'warn',
3435
},
3536
},
37+
{
38+
files: ['tests/**/*.js'],
39+
languageOptions: {
40+
globals: {
41+
global: 'writable',
42+
beforeEach: 'readonly',
43+
describe: 'readonly',
44+
it: 'readonly',
45+
expect: 'readonly',
46+
vi: 'readonly',
47+
},
48+
},
49+
},
3650
{
3751
ignores: [
3852
'node_modules/**',

0 commit comments

Comments
 (0)