Testing Strategy for Stremio Web: Jest, CI, and i18n Compliance

Stremio Web employs a Jest-based testing strategy focused on internationalization compliance and copyright verification, with all commits validated through a GitHub Actions CI pipeline that runs tests after every build.

Stremio Web maintains code quality through a targeted, lightweight testing architecture that prioritizes critical-path validation over exhaustive unit coverage. The repository uses Jest as its test runner to enforce coding standards, prevent hardcoded UI strings, and ensure legal compliance across the React-based streaming interface. This strategy keeps the codebase maintainable while catching localization and licensing regressions before they reach production.

Test Runner and Package Configuration

The testing infrastructure is centered on Jest, which is listed as a devDependency in package.json. The test script invokes Jest directly, allowing developers to execute the entire suite with pnpm test or npm test.

// package.json
"scripts": {
  "test": "jest",
  "lint": "eslint src/"
}

This configuration keeps the setup minimal, relying on Jest's zero-config defaults while allowing for custom test patterns in the tests/ directory.

Core Test Suites in tests/

All test files reside in the repository-root tests/ folder rather than alongside source files. The current suite focuses on compliance and static analysis rather than component behavior.

Internationalization Scanning (i18nScan.test.js)

The file tests/i18nScan.test.js implements a custom static analyzer that traverses the src/ directory and parses JSX/TSX files using Babel. It generates dynamic Jest tests for every string literal discovered in UI components. If a hardcoded string is found without a corresponding translation key in the localization bundle, the test fails immediately.

// Example failure output from i18nScan.test.js
 FAIL  tests/i18nScan.test.js
  ● Missing translation key › should not have "Play" in src/components/Button/index.tsx at line 42

    expect(received).toBeFalsy()

    Received: "Play"

To resolve such failures, developers must replace literal strings with translation function calls (e.g., t('play_button')) and add the key to the stremio-translations package.

License Header Verification (copyright.spec.js)

Located at tests/copyright.spec.js, this test ensures every source file contains the required GPL-2.0 copyright header. It acts as a legal compliance gate, scanning file headers to confirm they include the appropriate open-source license attribution before code is allowed to merge.

Continuous Integration with GitHub Actions

The testing strategy is enforced automatically via the GitHub Actions workflow defined in .github/workflows/build.yml. The pipeline compiles the application using webpack before executing the test suite, ensuring that tests run against buildable code.


# Conceptual representation of the CI sequence

steps:
  - build: webpack
  - test: pnpm test
  - lint: npm run lint

Because the test step runs after the build step, any Jest failure or ESLint error aborts the pipeline immediately. This prevents broken artifacts from being published and ensures that main branch commits always pass both static analysis and compliance checks.

Local Development Workflow

Developers can validate changes locally using the following commands:


# Install dependencies (pnpm preferred)

pnpm install

# Run the full Jest suite

pnpm test

# Run only the i18n scanner

pnpx jest ./tests/i18nScan.test.js

# Run the linter against src/

npm run lint

Key Files Supporting the Testing Strategy

File Role
package.json Defines Jest as the test runner and configures the test and lint scripts.
tests/i18nScan.test.js Babel-based scanner that generates failing tests for hardcoded strings lacking translation keys.
tests/copyright.spec.js Validates GPL-2.0 license headers in all source files.
.github/workflows/build.yml CI pipeline that executes pnpm test after the webpack build.
webpack.config.js Build configuration used by CI to generate the app bundle prior to testing.
src/ Source directory scanned by i18n and lint checks.

Summary

  • Jest serves as the single test runner for all validation, invoked via pnpm test.
  • The i18n scanner in tests/i18nScan.test.js enforces externalization of all user-visible strings by failing builds that contain hardcoded text.
  • Copyright compliance is verified by tests/copyright.spec.js, ensuring every file carries the GPL-2.0 header.
  • The CI pipeline in .github/workflows/build.yml gates releases by running tests and linting after every webpack build, blocking defective commits from reaching production.

Frequently Asked Questions

What testing framework does Stremio Web use?

Stremio Web uses Jest as its primary testing framework. The configuration is defined in package.json, where the test script invokes jest directly, enabling developers to run the suite with standard commands like pnpm test or npm test.

How does Stremio Web enforce internationalization through testing?

The repository uses tests/i18nScan.test.js to parse the src/ tree with Babel, generating dynamic Jest tests for every detected string literal. If a hardcoded UI string lacks a corresponding translation key, the test fails, forcing developers to use the i18n system (e.g., t('key')) rather than literal text.

The tests/copyright.spec.js file verifies that every source file contains the required GPL-2.0 copyright header. This ensures legal compliance and consistent licensing attribution across the entire distributed codebase.

How does the CI pipeline integrate with the testing strategy?

The GitHub Actions workflow defined in .github/workflows/build.yml builds the application with webpack and then executes pnpm test. Because the test step runs immediately after the build, any failure in the Jest suite or ESLint checks aborts the entire pipeline, preventing broken code from merging into the main branch.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →