lightningimg
Version:
A blazing fast, transparent, and safe image converter powered by WebAssembly. Convert PNG, JPG, TIFF, and GIF images to optimized WebP format with high performance and cross-platform compatibility.
115 lines (79 loc) • 4.02 kB
Plain Text
> lightningimg@1.0.1 test /Users/admin/Code/defuss/packages/lightningimg
> pnpm run test:esm && pnpm run test:browser
> lightningimg@1.0.1 test:esm /Users/admin/Code/defuss/packages/lightningimg
> node test-esm.js
🚀 Testing LightningImg ESM WASM-only implementation...
⚠️ No test image found, but core functions work. Image tests skipped.
🎉 Core ESM WASM implementation is working correctly.
> lightningimg@1.0.1 test:browser /Users/admin/Code/defuss/packages/lightningimg
> node test-browser-puppeteer.js
🖼️ LightningImg WASM Browser Test (Puppeteer Edition)
====================================================
🚀 Starting LightningImg WASM Browser Test with Puppeteer
📡 Starting test server...
📡 Test server running on http://localhost:3000
🌐 Launching browser...
📄 Loading test page: http://localhost:3000/
🔵 Browser Log: 🖼️ LightningImg WASM Browser Test Starting...
🔵 Browser Log: 📦 Importing WASM module...
🔵 Browser Log: ✅ WASM module imported successfully!
🔵 Browser Log: 🎨 Creating test image data...
🔴 Browser Error: Failed to load resource: the server responded with a status of 404 (Not Found)
🔵 Browser Log: 📊 Test image created: 610 bytes
🔵 Browser Log: 🔍 Testing isSupportedFormat...
🔵 Browser Log: ✅ Loaded Web WASM module
🔵 Browser Log: ✅ Format supported: true
🔵 Browser Log: 📏 Testing getImageInfo...
🔵 Browser Log: ✅ Image info: {"format":"PNG","width":100,"height":100}
🔵 Browser Log: 🔄 Testing convertImageBuffer (PNG to WebP)...
🔵 Browser Log: ✅ WebP conversion successful: 36 bytes
🔵 Browser Log: 🔄 Testing convertImageBuffer with resize (50x50)...
🔵 Browser Log: ✅ WebP resize conversion successful: 36 bytes
🔵 Browser Log: 🔄 Testing convertImageBuffer with width-only resize (75px width)...
🔵 Browser Log: ✅ WebP aspect ratio resize successful: 36 bytes
🔵 Browser Log: 📈 Conversion Results:
🔵 Browser Log: Original PNG: 610 bytes
🔵 Browser Log: WebP (default): 36 bytes (94.1% compression)
🔵 Browser Log: WebP (50x50 resize): 36 bytes (94.1% compression)
🔵 Browser Log: WebP (75px width): 36 bytes
🔵 Browser Log: 🎉 All browser tests passed successfully!
🔵 Browser Log: ✅ ESM WASM-only LightningImg with resize functionality works perfectly in browser!
⏳ Waiting for tests to complete...
📊 Test Results:
================
✅ Status: SUCCESS
📝 Test logs:
🖼️ LightningImg WASM Browser Test Starting...
📦 Importing WASM module...
✅ WASM module imported successfully!
🎨 Creating test image data...
📊 Test image created: 610 bytes
🔍 Testing isSupportedFormat...
✅ Format supported: true
📏 Testing getImageInfo...
✅ Image info: {"format":"PNG","width":100,"height":100}
🔄 Testing convertImageBuffer (PNG to WebP)...
✅ WebP conversion successful: 36 bytes
🔄 Testing convertImageBuffer with resize (50x50)...
✅ WebP resize conversion successful: 36 bytes
🔄 Testing convertImageBuffer with width-only resize (75px width)...
✅ WebP aspect ratio resize successful: 36 bytes
📈 Conversion Results:
Original PNG: 610 bytes
WebP (default): 36 bytes (94.1% compression)
WebP (50x50 resize): 36 bytes (94.1% compression)
WebP (75px width): 36 bytes
🎉 All browser tests passed successfully!
✅ ESM WASM-only LightningImg with resize functionality works perfectly in browser!
📈 Performance Stats:
Original PNG: 610 bytes
WebP (default): 36 bytes
Default compression: 94.1%
Image info: {"format":"PNG","width":100,"height":100}
Format supported: true
📸 Screenshot saved: /Users/admin/Code/defuss/packages/lightningimg/test-browser-screenshot.png
🔚 Browser closed
🔚 Test server closed
🎉 All browser tests passed successfully!
✅ ESM WASM-only LightningImg works perfectly in browser environment!