Frontend Frameworks

ts-jest-mock-import-meta

A TypeScript AST transformer for ts-jest to mock import.meta expressions.

Status
Generally available
Last checked
Aging · Sep 5, 2026
License
Open source
Pricing
Free tier · from $0

What it is

This tool provides a simple Typescript AST transformer that mocks import.meta expressions in Jest tests, making it easier to test code using dynamic imports and other meta properties.

The only tool specifically designed to mock import.meta expressions in ts-jest, providing a seamless way to test dynamic imports and meta properties without manual intervention.

When it fits — and when it doesn’t

A good fit for

  • TypeScript developers who need to test code using import.meta expressions.

  • Projects requiring precise control over the mocking of dynamic imports and meta properties in Jest tests.

Look elsewhere if

  • Developers working with languages other than TypeScript.

  • Projects that do not use Jest for testing.

Known weaknesses

Each one links to the public issue, changelog or docs page it came from, where we have one.

  1. 01

    Limited documentation and examples

    The tool's GitHub repository lacks comprehensive guides or tutorials, making it difficult for new users to understand its full capabilities.

  2. 02

    Narrow scope of functionality

    ts-jest-mock-import-meta is highly specialized in mocking import.meta expressions and does not address other common testing challenges, which may require additional tools or custom solutions.

  3. 03

    Potential for compatibility issues with newer TypeScript versions

    As a transformer tool, it heavily relies on the AST of TypeScript. With frequent updates to TypeScript, there is a risk that ts-jest-mock-import-meta may not be immediately compatible or require significant updates.

  4. 04

    Small and potentially inactive community support

    The tool's GitHub repository has limited activity, with few contributors and infrequent updates, which could lead to slower resolution of issues or feature requests.

What it does well

  • Mocks import.meta expressions in Jest tests.

  • Simplifies testing of code using dynamic imports and meta properties.

  • Integrates seamlessly with ts-jest.

Pricing

Free tier
YesOpen source — free to use
Paid from
$0
Model
Flat rate
Enterprise plan
No

Pricing not independently confirmed — check the vendor’s page.

Performance benchmarks

How Fast Is It?

Set up ts-jest-mock-import-meta

Setup steps, common gotchas and what to check after 30 days.

Open the setup guide →