MCPcopy Index your code
hub / github.com/Typescript-TDD/ts-auto-mock

github.com/Typescript-TDD/ts-auto-mock @3.7.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release 3.7.4 ↗ · + Follow
895 symbols 2,123 edges 385 files 2 documented · 0% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TS auto mock

Test npm version Downloads semantic-release Commitizen friendly GitHub Sponsor

All Contributors

Slack Need help? Join us on Slack

:warning: This repository is now no longer maintained for new features development :warning:

A few years ago we've created this project with the idea in mind that typescript transformers would be easier to configure.

Unfortunately the typescript team has no intention to improve the developer experience. You can see more information at this link.

We believe that stop developing new features is the best decision to inform who is currently using it and who find it for the first time.

We will keep fixing bugs and vulnerability.

Other reasons why this library might not be for you:

  • Typescript transformers works only when using the tsc typescript compiler. If you are using esbuild or swc you will not be able to use this library.
  • Test double are a double-edge sword. They have to be used carefully and at the right time. Increasing the number of test doubles could decrease the value of your tests. The amount of configuration required by this library might not justify the amount of test doubles that your application requires.

A TypeScript transformer that will allow you to create mocks for any types (interfaces, classes, etc.) without the need to create manual fakes/mocks.

API Documentation

Installation

Usage

Quick overview

import { createMock } from 'ts-auto-mock';

interface Person {
    id: string;

    getName(): string;

    details: {
        phone: number
    }
}

const mock = createMock<Person>();
mock.id // ""
mock.getName() // ""
mock.details // "{ phone: 0 }"

Changelog

Find the changelog here: Changelog.

Roadmap

You can find the roadmap of this project on the Wiki page: Roadmap.

Do you want to contribute?

Authors

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Artem Kornev 🐛 💻 Fabian 🐛 💻 Geoffrey 'C0ZEN' Testelin 🐛 💻 🤔 🔧 Giulio Caprino 💬 💻 📖 🤔 🚇 🚧 📆 Marc 🐛 💻 Martin Jesper Low Madsen 🐛 💻 🤔 Vittorio Guerriero 💬 💻 🤔 🚇 🚧 📆 🔧

This project follows the all-contributors specification. Contributions of any kind welcome!

Sponsor ✨

Thanks to these people

Kenta Mukai

License

This project is licensed under the MIT License

Extension points exported contracts — how you extend this code

SystemFileReader (Interface)
(no doc) [6 implementers]
utils/dataFileSystem/dataFileSystemReader.d.ts
IPerformanceService (Interface)
(no doc) [6 implementers]
ui/src/performance/performanceService/performanceService.tsx
InterfaceWithValues (Interface)
(no doc) [2 implementers]
test/frameworkContext/create-mock-values.test.ts
BasicCalculator (Interface)
(no doc) [2 implementers]
test/transformer/descriptor/this/this.test.ts
Interface (Interface)
(no doc)
performance/templates/withoutTsAutoMock.ts
TransformerLogger (Interface)
(no doc)
definitelyTypedTests/src/transformer/logger.ts
InterfaceWithConditionalType (Interface)
(no doc)
test/logs/createMockList.warning.test.ts
Interface (Interface)
(no doc)
test/registerMock/typeQuery/typeQuery.test.ts

Core symbols most depended-on inside this repo

createMock
called by 468
test/transformer/utilities/create-mock.ts
GetDescriptor
called by 45
src/transformer/descriptor/descriptor.ts
createIdentifier
called by 43
src/typescriptFactory/typescriptFactory.ts
getObjectKeyValues
called by 30
test/transformer/utilities/getObjectKeyValues.ts
get
called by 29
utils/dataFileSystem/dataFileSystemReader.d.ts
createCall
called by 27
src/typescriptFactory/typescriptFactory.ts
createPropertyAccess
called by 25
src/typescriptFactory/typescriptFactory.ts
filter
called by 25
ui/src/definitely-typed/filters/definitelyTypedFilters.tsx

Shape

Function 363
Interface 235
Method 153
Class 121
Enum 23

Languages

TypeScript100%

Modules by API surface

src/typescriptFactory/typescriptFactory.ts51 symbols
src/transformer/mockDefiner/mockDefiner.ts33 symbols
test/transformer/descriptor/generic/generic.test.ts24 symbols
src/transformer/logger/transformerLogger.ts23 symbols
test/transformer/descriptor/methods/methods.test.ts18 symbols
src/transformer/descriptor/helper/helper.ts16 symbols
test/createHydratedMock/create-hydrated-mock.test.ts15 symbols
test/transformer/descriptor/generic/extends.test.ts14 symbols
test/transformer/descriptor/this/this.test.ts11 symbols
test/transformer/descriptor/getAccessor/getAccessor.test.ts10 symbols
ui/src/definitely-typed/filters/definitelyTypedFilters.tsx9 symbols
test/transformer/descriptor/typeQuery/typeQuery.test.ts9 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add ts-auto-mock \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact