Socket
Book a DemoInstallSign in
Socket

civet-jest

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

civet-jest

Test Civet files with Jest

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
0
Created
Source

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

  • Install Civet if you haven't already: npm install -D @danielx/civet
  • 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.

Keywords

jest

FAQs

Package last updated on 08 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts