mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-11-30 18:11:44 +00:00
## Changes - Replace `indexOf()` with `startsWith()` for cleaner protocol detection - Use `URL` API for robust cache-busting parameter handling - Add HTTP response validation and improved error logging - Add JSDoc type annotations for better documentation - Remove unused `urlSuffix` instance variable - Add unit tests - Fix `.gitignore` pattern ## Motivation After merging #3967, I noticed some potential for improving reliability and user experience related to the method `loadComplimentFile`. With these changes the method now validates URLs upfront to catch configuration errors early, checks HTTP status codes to detect server issues (404/500), and provides specific error messages that help users troubleshoot problems. The complexity of the code does not really increase with the changes. On the contrary, the method should now be more intuitive to understand. ## Testing Added unit tests for `loadComplimentFile()` to validate the improvements: - HTTP error handling - Cache-busting Since E2E tests already cover the happy path, these unit tests focus on error cases and edge cases. ## Additional Fix While adding the test file, I discovered that the `.gitignore` pattern `modules` was incorrectly matching `tests/unit/modules/`, preventing test files from being tracked. Changed to `/modules` to only match the root directory.
91 lines
1.2 KiB
Plaintext
91 lines
1.2 KiB
Plaintext
# Various Node ignoramuses.
|
|
logs
|
|
*.log
|
|
npm-debug.log*
|
|
pids
|
|
*.pid
|
|
*.seed
|
|
lib-cov
|
|
coverage
|
|
.lock-wscript
|
|
build/Release
|
|
node_modules
|
|
jspm_modules
|
|
.npm
|
|
.node_repl_history
|
|
|
|
# Visual Studio Code ignoramuses.
|
|
.vscode/
|
|
|
|
# IDE Code ignoramuses.
|
|
.idea/
|
|
|
|
# Various Windows ignoramuses.
|
|
Thumbs.db
|
|
ehthumbs.db
|
|
Desktop.ini
|
|
$RECYCLE.BIN/
|
|
*.cab
|
|
*.msi
|
|
*.msm
|
|
*.msp
|
|
*.lnk
|
|
|
|
# Various OSX ignoramuses.
|
|
.DS_Store
|
|
.AppleDouble
|
|
.LSOverride
|
|
Icon
|
|
._*
|
|
.DocumentRevisions-V100
|
|
.fseventsd
|
|
.Spotlight-V100
|
|
.TemporaryItems
|
|
.Trashes
|
|
.VolumeIcon.icns
|
|
.AppleDB
|
|
.AppleDesktop
|
|
Network Trash Folder
|
|
Temporary Items
|
|
.apdisk
|
|
|
|
# Various Linux ignoramuses.
|
|
.fuse_hidden*
|
|
.directory
|
|
.Trash-*
|
|
|
|
# Ignore all modules except the default modules.
|
|
/modules/*
|
|
!/modules/default
|
|
|
|
# Ignore changes to the custom css files but keep the sample and main.
|
|
/css/*
|
|
!/css/custom.css.sample
|
|
!/css/font-awesome.css
|
|
!/css/main.css
|
|
!/css/roboto.css
|
|
|
|
# Ignore users config file but keep the sample.
|
|
config
|
|
!config/config.js.sample
|
|
|
|
# Vim
|
|
## swap
|
|
[._]*.s[a-w][a-z]
|
|
[._]s[a-w][a-z]
|
|
|
|
## diff patch
|
|
*.orig
|
|
*.rej
|
|
*.bak
|
|
|
|
# Ignore positions file (#3518)
|
|
js/positions.js
|
|
|
|
# Ignore lock files other than package-lock.json
|
|
pnpm-lock.yaml
|
|
yarn.lock
|
|
|
|
# Vitest temporary test files
|
|
tests/**/.tmp/
|