Test Overview
The test suite validates:- N-parameter transformations - URL signature decryption
- Signature solving - Video signature decryption
- Multiple player variants - main, tcc, tce, es5, es6, tv, phone variants
- Cross-runtime compatibility - Deno, Bun, and Node.js
Tests use real YouTube player JavaScript files that are downloaded before running the test suite.
Setting Up the Test Environment
Before running tests, you need to install dependencies and download player files.Step 1: Install Dependencies
Choose your runtime and install dependencies:- Deno
- Bun
- Node.js
Step 2: Download Player Files
Download the YouTube player JavaScript files used for testing:- Deno
- Bun
- Node.js
- Fetches player files from YouTube (www.youtube.com)
- Saves them to
src/yt/solver/test/players/ - Downloads all variants needed for the test suite
- Uses cached files when available
Running Tests
Once dependencies are installed and player files are downloaded, run the tests:- Deno
- Bun
- Node.js
Test Structure
Tests are organized insrc/yt/solver/test/:
Test Definitions
Each test intests.ts defines:
- Player ID - 8-character hash identifying the player version
- Variants - Which player variants to test (main, tcc, tce, es5, es6, tv, tv_es6, phone)
- N-parameter tests - Input/expected output pairs for URL decryption
- Signature tests - Input/expected output pairs for signature decryption
Example Test Structure
Example Test Structure
Player Variants
The test suite validates multiple YouTube player variants:main- Standard player (player_ias.vflset)tcc- Type-checking compiled (player_ias_tcc.vflset)tce- Type-checking enabled (player_ias_tce.vflset)es5- ES5-compatible playeres6- ES6+ playertv- TV platform playertv_es6- TV ES6 playerphone- Mobile phone playeres6_tcc- ES6 with type-checking compiledes6_tce- ES6 with type-checking enabled
Some player versions have issues with certain variants (e.g., “tce causes exception even in browser”). These are tested across other variants for regression testing.
What Tests Validate
The test suite ensures:- Correct decryption - Player transformations produce expected outputs
- Runtime compatibility - Same results across Deno, Bun, and Node.js
- Player variant handling - All player types are correctly processed
- Regression prevention - Historical player versions continue working
Parallel Test Execution
For faster execution, you can run tests in parallel:- Uses
xargswith-P 10for 10 parallel processes - Filters tests by variant name
- Runs each variant test independently
CI Test Workflow
The GitHub Actions CI runs tests across:- Runtimes: Deno (2.0.0+), Bun (1.2.11+), Node (22.18+)
- Platforms: Ubuntu and Windows (Python tests)
- Python versions: 3.10, 3.11, 3.12, 3.13, 3.14, PyPy 3.11
- Caches player files based on
tests.tshash - Downloads player files once (15 min timeout)
- Runs tests in parallel across all runtimes
- Validates Python integration
Troubleshooting
Missing Player Files
If tests fail with “player file not found”:Permission Errors (Deno)
Deno requires explicit permissions. Use:Test Failures
If tests fail:- Check you’re using the correct runtime version (see requirements above)
- Ensure player files are downloaded successfully
- Verify dependencies are installed with frozen lockfiles
- Check for network issues during player download
Python Tests
To run Python-specific tests:- Package structure and imports
- JavaScript integration
- Cross-platform compatibility (Windows/Linux)
