0.0.0 • Published 12 months ago

civet-jest v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

civet-jest

civet-jest is a Jest transformer for automatically transpiling Civet code into JavaScript when testing via Jest.

It does not yet support chaining with babel-jest, so JSX is not supported.

Usage

Installation

  1. Install Civet if you haven't already: npm install -D @danielx/civet
  2. Install this plugin: npm install -D civet-jest

Configuration

Edit your jest.config.* file to define the transform and allow the .civet file extension. Here is an complete example jest.config.mjs:

import {defaults} from 'jest-config'

export default {
  extensionsToTreatAsEsm: [ '.civet' ],
  moduleFileExtensions: [ ...defaults.moduleFileExtensions, 'civet' ],
  testMatch: [ '<rootDir>/test/**/*.civet' ],
  transform: {
    '\\.civet': 'civet-jest',
  },
  verbose: true,
}

This directory has a similar jest.config.mjs that enables local testing via yarn test.

package.json script

In CommonJS mode, you should be able to just use:

{
  "scripts": {
    "test": "jest"
  }
}

In ESM mode, you need something like this:

{
  "scripts": {
    "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
  }
}

This directory has a similar package.json that enables local testing via yarn test.

0.0.0

12 months ago