0.0.1-alpha.0 • Published 3 years ago

@guidecx/config-jest v0.0.1-alpha.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

GCX Jest Config

This module contains the configuration files for Jest that are used by all GuideCX applications.

As with many of our other packages, you'll need to make sure you have the proper devDependencies installed for this library to have any effect. For this package you'll need:

  • jest
  • jest-transform-graphql
  • babel-jest
  • jest-environment-jsdom-fifteen
  • jest-watch-typeahead

Some of the config options require special packages, other than the packages previously mentioned. If not using these packages, such as those related to graphql, override the relevant properties on the config options object. For example:

import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
  ...require('../config-jest'),
  setupFiles: [],
  setupFilesAfterEnv: [],
  transform: {
    '\\.[jt]sx?$': 'babel-jest',
    '^.+\\.(ts|tsx)$': 'ts-jest',
  },
};

export default config;

Installing library into another project

We have 2 variant files that are exposed to other applications; express and react. Depending on the type of application you're importing configurations too, you can do the following in your jest.config.js file:

module.exports = {
  ...require('@guidecx/config-jest/react'),
  // overwrite config options as-needed
};

Once this is complete, verify that you have the following configuration options in your package.json:

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