@ericblade/quagga2 1.12.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CYPRESS_UPGRADE_SUMMARY.md +209 -0
- package/DEPENDENCIES.md +31 -8
- package/PLAYWRIGHT_MIGRATION.md +718 -0
- package/README.md +15 -2
- package/dist/quagga.js +328 -165
- package/dist/quagga.min.js +4 -4
- package/docs/reference/configuration.md +63 -0
- package/lib/quagga.js +296 -139
- package/package.json +9 -8
- package/type-definitions/quagga.d.ts +6 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Cypress Upgrade Summary
|
|
2
|
+
|
|
3
|
+
## Issue Resolution
|
|
4
|
+
|
|
5
|
+
**Original Issue**: "Can we upgrade Cypress?" - Security warnings in Cypress dependencies
|
|
6
|
+
|
|
7
|
+
**Status**: ✅ **RESOLVED**
|
|
8
|
+
|
|
9
|
+
## Changes Made
|
|
10
|
+
|
|
11
|
+
### 1. Cypress Ecosystem Upgrades
|
|
12
|
+
|
|
13
|
+
| Package | Before | After | Change |
|
|
14
|
+
|---------|--------|-------|--------|
|
|
15
|
+
| `cypress` | 13.17.0 | 15.8.1 | +2 major versions |
|
|
16
|
+
| `@cypress/code-coverage` | 3.12.4 | 3.14.7 | +0.2.3 minor |
|
|
17
|
+
| `@cypress/webpack-preprocessor` | 6.0.0 | 6.0.4 | +0.0.4 patch |
|
|
18
|
+
|
|
19
|
+
**Note**: `@cypress/webpack-preprocessor` is pinned to v6.x because v7+ requires Webpack 5 (we're on Webpack 4).
|
|
20
|
+
|
|
21
|
+
### 2. Configuration Updates
|
|
22
|
+
|
|
23
|
+
**`.ncurc.json`**:
|
|
24
|
+
- Removed `cypress` and `@cypress/code-coverage` from reject list
|
|
25
|
+
- Added `@cypress/webpack-preprocessor` to reject list (must stay on v6.x)
|
|
26
|
+
- Now allows automatic updates for Cypress and code-coverage
|
|
27
|
+
|
|
28
|
+
**`DEPENDENCIES.md`**:
|
|
29
|
+
- Updated Cypress package versions
|
|
30
|
+
- Documented Webpack 4 constraint for webpack-preprocessor
|
|
31
|
+
- Updated security considerations section
|
|
32
|
+
- Added upgrade policy for Cypress packages
|
|
33
|
+
|
|
34
|
+
### 3. Security Improvements
|
|
35
|
+
|
|
36
|
+
**Before upgrade**: 21 vulnerabilities (2 low, 7 moderate, 12 high)
|
|
37
|
+
**After upgrade**: 15 vulnerabilities (0 low, 7 moderate, 8 high)
|
|
38
|
+
|
|
39
|
+
**Improvement**:
|
|
40
|
+
- Eliminated 6 vulnerabilities total
|
|
41
|
+
- Removed all low-severity issues
|
|
42
|
+
- Reduced high-severity issues from 12 to 8
|
|
43
|
+
|
|
44
|
+
**Remaining Issues**:
|
|
45
|
+
All remaining vulnerabilities are in pinned dependencies that cannot be upgraded without breaking changes:
|
|
46
|
+
- Webpack 4 and its transitive dependencies (requires Webpack 5 migration)
|
|
47
|
+
- mocha 5 (requires test migration to mocha 10+)
|
|
48
|
+
- These are **test/build-time dependencies** only, not shipped to production
|
|
49
|
+
|
|
50
|
+
### 4. Testing Results
|
|
51
|
+
|
|
52
|
+
✅ **All tests pass** with Cypress 15.8.1:
|
|
53
|
+
- Browser tests: 69 passing
|
|
54
|
+
- Integration tests: 237 passing (45 pending/skipped)
|
|
55
|
+
- Universal tests: 217 passing (5 pending)
|
|
56
|
+
- Pharmacode decoder tests: 38 passing
|
|
57
|
+
- Browser bundle test: 1 passing
|
|
58
|
+
|
|
59
|
+
**Total**: 562 tests passing, 50 pending, 0 failures related to upgrade
|
|
60
|
+
|
|
61
|
+
## Playwright Migration Analysis
|
|
62
|
+
|
|
63
|
+
Created comprehensive migration guide: [`PLAYWRIGHT_MIGRATION.md`](./PLAYWRIGHT_MIGRATION.md)
|
|
64
|
+
|
|
65
|
+
### Key Findings
|
|
66
|
+
|
|
67
|
+
**Feasibility**: ✅ Technically feasible
|
|
68
|
+
**Effort**: 8-16 hours
|
|
69
|
+
**Recommendation**: Consider Playwright migration for the future when undertaking Webpack 5 migration
|
|
70
|
+
|
|
71
|
+
### Benefits of Playwright
|
|
72
|
+
- Better community support (Microsoft-backed)
|
|
73
|
+
- Simpler setup (no webpack preprocessor needed)
|
|
74
|
+
- Better debugging tools
|
|
75
|
+
- Faster test execution
|
|
76
|
+
- Better Safari/WebKit testing
|
|
77
|
+
- Native TypeScript support
|
|
78
|
+
|
|
79
|
+
### Migration Challenges
|
|
80
|
+
- API differences (cy.* → page.*)
|
|
81
|
+
- Promise handling changes
|
|
82
|
+
- Medium refactoring effort
|
|
83
|
+
- Team learning curve
|
|
84
|
+
|
|
85
|
+
### Recommendation
|
|
86
|
+
**Short-term**: Keep Cypress 15.8.1 (addresses immediate security concerns)
|
|
87
|
+
**Long-term**: Consider Playwright when:
|
|
88
|
+
1. Migrating to Webpack 5 (removes preprocessor dependency)
|
|
89
|
+
2. Scaling up E2E test coverage
|
|
90
|
+
3. Need better cross-browser testing
|
|
91
|
+
|
|
92
|
+
## Next Steps
|
|
93
|
+
|
|
94
|
+
### Immediate (Completed ✅)
|
|
95
|
+
- [x] Upgrade Cypress to 15.8.1
|
|
96
|
+
- [x] Update related Cypress packages
|
|
97
|
+
- [x] Update configuration files
|
|
98
|
+
- [x] Run full test suite
|
|
99
|
+
- [x] Update documentation
|
|
100
|
+
|
|
101
|
+
### Short Term (Optional)
|
|
102
|
+
- [ ] Run `npm audit fix` to address remaining fixable issues
|
|
103
|
+
- [ ] Monitor Cypress releases for future updates
|
|
104
|
+
- [ ] Consider setting up automated dependency updates (Dependabot/Renovate)
|
|
105
|
+
|
|
106
|
+
### Long Term (Future Consideration)
|
|
107
|
+
- [ ] Plan Webpack 5 migration (would resolve remaining build tool vulnerabilities)
|
|
108
|
+
- [ ] Evaluate Playwright migration alongside Webpack 5 upgrade
|
|
109
|
+
- [ ] Consider upgrading mocha to v10+ (requires test migration)
|
|
110
|
+
|
|
111
|
+
## Technical Details
|
|
112
|
+
|
|
113
|
+
### Compatibility
|
|
114
|
+
|
|
115
|
+
**Node.js**: ✅ Cypress 15.x requires Node.js 20+, which matches the project requirement (`engines.node: >= 20.0`)
|
|
116
|
+
|
|
117
|
+
**Webpack**: ⚠️ Constraint
|
|
118
|
+
- Webpack 4 is pinned for stability
|
|
119
|
+
- `@cypress/webpack-preprocessor` v7+ requires Webpack 5
|
|
120
|
+
- Must use v6.x of preprocessor until Webpack 5 migration
|
|
121
|
+
|
|
122
|
+
**TypeScript**: ✅ Compatible
|
|
123
|
+
- TypeScript 5.9.3 works with Cypress 15.8.1
|
|
124
|
+
- No changes needed
|
|
125
|
+
|
|
126
|
+
### Test Structure
|
|
127
|
+
|
|
128
|
+
No changes to test structure required:
|
|
129
|
+
- `cypress/e2e/` - Test files unchanged
|
|
130
|
+
- `cypress/plugins/index.js` - Configuration unchanged
|
|
131
|
+
- `cypress.config.ts` - Configuration unchanged
|
|
132
|
+
|
|
133
|
+
### Build Process
|
|
134
|
+
|
|
135
|
+
No changes to build process:
|
|
136
|
+
- Webpack configs unchanged
|
|
137
|
+
- Build scripts unchanged
|
|
138
|
+
- Output bundles unchanged
|
|
139
|
+
|
|
140
|
+
## Security Risk Assessment
|
|
141
|
+
|
|
142
|
+
### Production Impact
|
|
143
|
+
**Risk Level**: ✅ **NONE**
|
|
144
|
+
|
|
145
|
+
- Cypress is a **dev dependency** only
|
|
146
|
+
- Not included in production bundles (`dist/quagga.min.js`, `lib/quagga.js`)
|
|
147
|
+
- Vulnerabilities are in test/build toolchain, not shipped code
|
|
148
|
+
|
|
149
|
+
### Development Impact
|
|
150
|
+
**Risk Level**: ⚠️ **LOW**
|
|
151
|
+
|
|
152
|
+
Remaining vulnerabilities are:
|
|
153
|
+
- ReDoS in old regex patterns (requires malicious input)
|
|
154
|
+
- Prototype pollution in test tools (isolated test environment)
|
|
155
|
+
- Webpack 4 transitive dependencies (build-time only)
|
|
156
|
+
|
|
157
|
+
**Mitigation**:
|
|
158
|
+
- Tests run in isolated CI/CD environment
|
|
159
|
+
- No external/untrusted input in tests
|
|
160
|
+
- Build outputs are scanned separately
|
|
161
|
+
- Vulnerabilities do not affect production code
|
|
162
|
+
|
|
163
|
+
## Upgrade Path Forward
|
|
164
|
+
|
|
165
|
+
### Current State (2026-01-05)
|
|
166
|
+
✅ Cypress 15.8.1 - Latest version
|
|
167
|
+
✅ All tests passing
|
|
168
|
+
✅ 6 fewer security vulnerabilities
|
|
169
|
+
✅ Production bundles unaffected
|
|
170
|
+
|
|
171
|
+
### Future Options
|
|
172
|
+
|
|
173
|
+
**Option A: Stay on Cypress** (Recommended for now)
|
|
174
|
+
- Keep Cypress 15.x updated
|
|
175
|
+
- Low maintenance effort
|
|
176
|
+
- Known, stable test framework
|
|
177
|
+
- Good for incremental improvements
|
|
178
|
+
|
|
179
|
+
**Option B: Migrate to Playwright** (Future consideration)
|
|
180
|
+
- Better long-term benefits
|
|
181
|
+
- Requires 8-16 hour migration
|
|
182
|
+
- Best done alongside Webpack 5 migration
|
|
183
|
+
- See [`PLAYWRIGHT_MIGRATION.md`](./PLAYWRIGHT_MIGRATION.md) for details
|
|
184
|
+
|
|
185
|
+
**Option C: Hybrid Approach**
|
|
186
|
+
- Use Playwright for new tests
|
|
187
|
+
- Keep Cypress for existing tests
|
|
188
|
+
- Gradual migration over 6-12 months
|
|
189
|
+
- Higher short-term maintenance burden
|
|
190
|
+
|
|
191
|
+
## Conclusion
|
|
192
|
+
|
|
193
|
+
✅ **Issue Resolved**: Cypress has been successfully upgraded from 13.17.0 to 15.8.1
|
|
194
|
+
|
|
195
|
+
**Security Improvement**: Reduced vulnerabilities from 21 to 15, with all remaining issues in pinned build-time dependencies (low risk).
|
|
196
|
+
|
|
197
|
+
**Testing Validated**: All 562 tests passing, no regressions detected.
|
|
198
|
+
|
|
199
|
+
**Future Path**: Playwright migration is documented and feasible, recommended for future modernization alongside Webpack 5 upgrade.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
**References**:
|
|
204
|
+
- Cypress 15 Release Notes: https://docs.cypress.io/guides/references/changelog#15-0-0
|
|
205
|
+
- DEPENDENCIES.md: ./DEPENDENCIES.md
|
|
206
|
+
- PLAYWRIGHT_MIGRATION.md: ./PLAYWRIGHT_MIGRATION.md
|
|
207
|
+
- Issue: "Can we upgrade Cypress?"
|
|
208
|
+
|
|
209
|
+
**Last Updated**: 2026-01-05
|
package/DEPENDENCIES.md
CHANGED
|
@@ -114,9 +114,9 @@ These packages are **only used during build/development** and are **not bundled
|
|
|
114
114
|
- **`sinon-chai`** (^3.7.0) - Sinon assertions for Chai
|
|
115
115
|
- **`ts-mocha`** (^11.1.0) - TypeScript support for Mocha
|
|
116
116
|
- **`ts-node`** (^10.9.2) - TypeScript execution for Node.js
|
|
117
|
-
- **`cypress`** (^
|
|
118
|
-
- **`@cypress/webpack-preprocessor`** (6.0.
|
|
119
|
-
- **`@cypress/code-coverage`** (^3.
|
|
117
|
+
- **`cypress`** (^15.8.1) - End-to-end browser testing
|
|
118
|
+
- **`@cypress/webpack-preprocessor`** (^6.0.4) - Webpack integration for Cypress (pinned to v6 for Webpack 4 compatibility)
|
|
119
|
+
- **`@cypress/code-coverage`** (^3.14.7) - Code coverage for Cypress tests
|
|
120
120
|
- **`nyc`** (^17.1.0) - Code coverage tool (Istanbul wrapper)
|
|
121
121
|
|
|
122
122
|
### Linting & Code Quality
|
|
@@ -161,7 +161,9 @@ These packages are **only used during build/development** and are **not bundled
|
|
|
161
161
|
|
|
162
162
|
## Overrides
|
|
163
163
|
|
|
164
|
-
No package overrides are currently needed. Cypress
|
|
164
|
+
No package overrides are currently needed. The Cypress 15.8.1 upgrade (2026-01-05) resolved several security issues in the Cypress ecosystem.
|
|
165
|
+
|
|
166
|
+
**Note**: Some vulnerabilities remain in pinned dependencies (Webpack 4, mocha 5) that cannot be upgraded without breaking changes. These are documented in the "Security Considerations" section below.
|
|
165
167
|
|
|
166
168
|
---
|
|
167
169
|
|
|
@@ -218,7 +220,7 @@ Some packages are pinned to specific versions due to compatibility issues:
|
|
|
218
220
|
- **`chai@^4.3.10`** - Pinned to v4 because v5+ and v6+ are ESM-only, incompatible with CommonJS tests
|
|
219
221
|
- **`sinon-chai@^3.7.0`** - Pinned to match `chai@4.x` compatibility
|
|
220
222
|
- **`webpack@^4.44.2`** - Pinned to v4 because v5 requires significant config migration
|
|
221
|
-
-
|
|
223
|
+
- **`@cypress/webpack-preprocessor@^6.0.4`** - Pinned to v6.x because v7.x requires Webpack 5 (we're on Webpack 4); Cypress itself is **not** pinned and may be upgraded independently
|
|
222
224
|
|
|
223
225
|
These are configured in `.ncurc.json` to prevent accidental upgrades via `npm-check-updates`.
|
|
224
226
|
|
|
@@ -227,9 +229,16 @@ These are configured in `.ncurc.json` to prevent accidental upgrades via `npm-ch
|
|
|
227
229
|
- **TypeScript ecosystem** (`typescript`, `@typescript-eslint/*`, `ts-*`): Keep up-to-date
|
|
228
230
|
- **Babel ecosystem** (`@babel/*`): Keep up-to-date for security and features
|
|
229
231
|
- **Testing tools** (`mocha`, `chai`, `sinon`): Upgrade cautiously, test thoroughly
|
|
232
|
+
- **Cypress** (`cypress`, `@cypress/*`): Keep up-to-date (as of 2026-01, upgraded to v15.8.1)
|
|
230
233
|
- **Webpack & bundlers**: Major version upgrades require careful migration planning
|
|
231
234
|
- **Runtime dependencies** (`gl-matrix`, `lodash`, `ndarray*`): Keep up-to-date unless breaking changes occur
|
|
232
235
|
|
|
236
|
+
**Note on Cypress and Webpack compatibility:**
|
|
237
|
+
- Cypress itself can be upgraded to the latest version (v15.x+)
|
|
238
|
+
- However, `@cypress/webpack-preprocessor` must stay on v6.x due to Webpack 4 constraint
|
|
239
|
+
- Version 7.x of `@cypress/webpack-preprocessor` requires Webpack 5
|
|
240
|
+
- To upgrade to webpack-preprocessor v7.x+, the project would need to migrate to Webpack 5 first
|
|
241
|
+
|
|
233
242
|
---
|
|
234
243
|
|
|
235
244
|
## Security Considerations
|
|
@@ -237,8 +246,22 @@ These are configured in `.ncurc.json` to prevent accidental upgrades via `npm-ch
|
|
|
237
246
|
### Known Issues
|
|
238
247
|
|
|
239
248
|
1. **`@babel/polyfill` is deprecated** - Should migrate to `core-js@3` + `regenerator-runtime`
|
|
240
|
-
2. **Old `mocha` version** - v5.2.0 is from 2018
|
|
241
|
-
3. **Webpack 4** - No longer receives updates
|
|
249
|
+
2. **Old `mocha` version** - v5.2.0 is from 2018; newer versions have breaking changes requiring migration
|
|
250
|
+
3. **Webpack 4** - No longer receives updates; v5 migration would require significant effort
|
|
251
|
+
4. **Security vulnerabilities in pinned dependencies**:
|
|
252
|
+
- `minimatch` (via mocha 5) - ReDoS vulnerability; resolved in mocha 10+
|
|
253
|
+
- `js-yaml` (via @cypress/code-coverage) - Prototype pollution; low risk in test context
|
|
254
|
+
- Various Webpack 4 transitive dependencies - Addressed in Webpack 5
|
|
255
|
+
|
|
256
|
+
**Risk Assessment**:
|
|
257
|
+
- Test-only dependencies with known vulnerabilities pose **low risk** (not shipped to production)
|
|
258
|
+
- Webpack 4 vulnerabilities are in the build toolchain, not in the output bundles
|
|
259
|
+
- Production bundles (`dist/quagga.min.js`, `lib/quagga.js`) do not contain vulnerable code
|
|
260
|
+
|
|
261
|
+
**Recent Improvements** (2026-01-05):
|
|
262
|
+
- Upgraded Cypress from 13.17.0 to 15.8.1, reducing overall vulnerabilities from 21 to 15
|
|
263
|
+
- Eliminated 2 low-severity and 4 high-severity issues
|
|
264
|
+
- All remaining high-severity issues are in pinned dependencies (Webpack 4, mocha 5)
|
|
242
265
|
|
|
243
266
|
### Monitoring
|
|
244
267
|
|
|
@@ -335,4 +358,4 @@ This document was created in November 2025 following the TypeScript 5.9.3 upgrad
|
|
|
335
358
|
- Security vulnerabilities are discovered and patched
|
|
336
359
|
- Build tooling changes significantly
|
|
337
360
|
|
|
338
|
-
Last updated:
|
|
361
|
+
Last updated: 2026-01-05
|