GitXplorerGitXplorer
a

jest-chain-transform

public
16 stars
3 forks
1 issues

Commits

List of commits on branch main.
Unverified
e9b67e82cd247fa29990179e8980c016a65f32b6

fix: ts

aanc95 committed 3 months ago
Unverified
fe06fb89dd8d963cd71552fd3de8c20e4d538a37

update lock

aanc95 committed 3 months ago
Verified
898f3fddb6cd78aedfdeec12326dda57b43d460c

Merge pull request #13 from olafbuitelaar/patch-1

aanc95 committed 3 months ago
Verified
d2430d6218375aca57b19259179201516a81ac39

Update package.json

oolafbuitelaar committed 3 months ago
Verified
275ad6cef28c85a86b16203def3efc8114342856

update peerDependecy for jest-transform

oolafbuitelaar committed 4 months ago
Unverified
22743e18cc9c0f3a26a27eb1f4260bbfddd1604d

change version

aanc95 committed 7 months ago

README

The README file for this repository.

jest-chain-transform

Node.js Package Node.js CI

jest-chain-transform enables jest can transform file by multiple transformers.

install

npm

npm install jest-chain-transform -D

yarn

yarn add jest-chain-transform -D

config

// jest.config.js
module.exports = {
  transform: {
    "\\.[jt]sx?$": [
      'jest-chain-transform',
      {
        transformers: [
          'path-of-your-custom-transformer', 'ts-jest'
        ]
      }
    ]
  },
}

Jest will transform all files that match \\.[jt]sx?$ by path-of-your-custom-transformer and 'ts-jest' in turn.

If you need to pass extra option to transform, you can write config as follow

// jest.config.js
module.exports = {
  transform: {
    "\\.[jt]sx?$": [
      'jest-chain-transform',
      {
        transformers: [
          ['path-of-your-custom-transformer', { ... }],
          ['babel-jest', { ... }]
        ]
      }
    ]
  },
}

option

interface Config {
  /**
   * multiple transforms
   * @example
   * ```js
   * ['babel-jest', 'ts-jest']
   * [
   *   ['babel-jest', { }],
   *   ['ts-jest', { }]
   * ]
   * ```
   */
  transformers: string[] | [string, Record<string, any>][];
}