Nerfing Powerful Megalomaniacs

    @side/jest-runtime

    1.1.0 • Public • Published

    @side/jest-runtime

    Custom runtime for Jest which addresses memory leak when using Typescript

    Build Status Coverage semantic-release Code Style

    NOTE This package was intentionally left as JS instead of being converted to TS because it is only a slight modification of existing Jest code based on this PR

    1. Install SWC if you haven't already @swc/core @swc/jest

    2. Make sure to configure SWC if you haven't already:

      {
         "jsc": {
            "parser": {
               "syntax": "typescript",
               "decorators": true
            },
            "transform": {
               "legacyDecorator": true,
               "decoratorMetadata": true
            }
         }
      }
      
    3. Install custom runtime: yarn add @side/jest-runtime

    4. Use within jest.config.js:

      module.exports = {
        transform: {
          '^.+\\.ts$': '@swc/jest',
        },
        runtime: '@side/jest-runtime',
      };

    Why?

    We were seeing memory leaks using ts-jest with node >16.10. When investigating solutions this PR fixing the issue was noticed. Since it hasn't been merged, and we still wanted to share this logic, we created this lib.

    Keywords

    none

    Install

    npm i @side/jest-runtime

    DownloadsWeekly Downloads

    11,921

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    9.02 kB

    Total Files

    4

    Last publish

    Collaborators

    • reside-eng