ts-jest-mock-import-meta

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

GrowingOpen SourceLow lock-in

Pricing

Free tier

Flat rate

Adoption

Stable

License

Open Source

Data freshness

Aging · Jun 8, 2026

Overview

What is ts-jest-mock-import-meta?

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.

Key differentiator

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.

Capability profile

Capability Radar

Ease of StartEcosystemValueMaturityFlexibilityScale Ready

Honest assessment

Strengths & Weaknesses

↑ Strengths

Mocks import.meta expressions in Jest tests.medium

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

Integrates seamlessly with ts-jest.medium

↓ Weaknesses

Limited documentation and exampleshigh

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

Narrow scope of functionalitymedium

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.

Potential for compatibility issues with newer TypeScript versionshigh

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.

Small and potentially inactive community supportmedium

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.

Fit analysis

Who is it for?

✓ Best 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.

✕ Not a fit for

Developers working with languages other than TypeScript.

Projects that do not use Jest for testing.

Cost structure

Pricing

Free Tier

Available

Open source — free to use

Starts at

$0

Model

Flat rate

Enterprise

None

Performance benchmarks

How Fast Is It?

Ecosystem

Relationships

Next step

Get Started with ts-jest-mock-import-meta

Step-by-step setup guide with code examples and common gotchas.

View Setup Guide →