npm.io
1.1.2 • Published 3 years ago

@macro-plugin/jest

Licence
MIT
Version
1.1.2
Deps
2
Size
14 kB
Vulns
0
Weekly
0
Stars
16

@macro-plugin/jest

Macro Plugin integration for jest. It supports transform macros and typescript and also jsx.

Installation

# if you use npm
npm i -D @macro-plugin/jest
# if you use pnpm
pnpm i -D @macro-plugin/jest
# if you use yarn
yarn add -D @macro-plugin/jest

Usage

jest.config.js:

module.exports = {
  transform: {
    '^.+\\.(t|j)sx?

It will load the configuration from macros.config.js or macros.config.ts by default. You can also customize it:

const fs = require('fs')
const config = require('./macros.config.js')

module.exports = {
  transform: {
    '^.+\\.(t|j)sx?

macros.config.ts:

import { defineConfig } from "@macro-plugin/core"

export default defineConfig({
  macros: [],
  emitDts: true,
  jsc: {
    parser: {
      syntax: "typescript"
    },
    target: "esnext",
  },
})

Or with commonjs

macros.config.js

/** @type {import("@macro-plugin/core").Config} */
module.exports = {
  macros: [],
  emitDts: true,
  jsc: {
    parser: {
      syntax: "typescript"
    },
    target: "esnext",
  },
}

License

MIT

: '@macro-plugin/jest', }, }

It will load the configuration from __INLINE_CODE_1__ or __INLINE_CODE_2__ by default. You can also customize it:

__CODE_BLOCK_2__

__INLINE_CODE_3__:

__CODE_BLOCK_3__

Or with commonjs

__INLINE_CODE_4__

__CODE_BLOCK_4__

License

MIT

: ['@macro-plugin/jest', { ...config, /* custom configuration in Jest */ }], }, }

__INLINE_CODE_3__:

__CODE_BLOCK_3__

Or with commonjs

__INLINE_CODE_4__

__CODE_BLOCK_4__

License

MIT

: '@macro-plugin/jest', }, }

It will load the configuration from __INLINE_CODE_1__ or __INLINE_CODE_2__ by default. You can also customize it:

__CODE_BLOCK_2__

__INLINE_CODE_3__:

__CODE_BLOCK_3__

Or with commonjs

__INLINE_CODE_4__

__CODE_BLOCK_4__

License

MIT

Keywords