0.25.0 • Published 6 months ago

@discord/jest-processor-discord-intl v0.25.0

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

@discord/jest-processor-discord-intl

A processor plugin for Jest to handle intl message definitions and translations from @discord/intl.

In your Jest config, add this as a transformer for message file patterns:

module.exports = {
  transform: {
    // Order matters here! Even though this is an Object, Jest still processes these first to
    // last (object insertion order). These patterns can overlap, so we want to put all of the
    // special handling first.
    [INTL_MESSAGES_FILE_PATTERN]: require.resolve('@discord/jest-processor-discord-intl'),
    // ...other transforms, like `*.tsx?` and more.
  },
};

You'll also need to use the babel plugin to transform consuming code like normal bundling:

// In a custom processor or wherever you configure Babel for Jest:
babel.transform({
  // ...
  plugins: [
    [
      require.resolve('@discord/babel-plugin-transform-discord-intl'),
      {
        // Jest does _not_ resolve these to absolute paths, so tell the plugin to use the
        // original import paths instead of resolving them like it does for Metro.
        preserveImportSource: true,
        extraImports: {
          '@app/intl': ['t', 'untranslated', 'international'],
        },
      },
    ],
  ],
});
0.18.0-rc.0

10 months ago

0.20.1

10 months ago

0.20.0

10 months ago

0.19.0

10 months ago

0.19.1

10 months ago

0.19.2

10 months ago

0.11.2-rc.3

1 year ago

0.13.0

1 year ago

0.11.2

1 year ago

0.13.1

1 year ago

0.11.3

1 year ago

0.15.0

1 year ago

0.13.2

1 year ago

0.11.4

1 year ago

0.13.3

1 year ago

0.11.5

1 year ago

0.17.0

10 months ago

0.11.6

1 year ago

0.23.3

7 months ago

0.25.0

6 months ago

0.23.2

7 months ago

0.23.1

8 months ago

0.23.0

9 months ago

0.21.1

9 months ago

0.21.0

9 months ago

0.12.0

1 year ago

0.14.0

1 year ago

0.16.0

11 months ago

0.16.1

11 months ago

0.18.0

10 months ago

0.24.0

7 months ago

0.22.1

9 months ago

0.22.0

9 months ago

0.22.0-rc.1

9 months ago

0.22.0-rc.0

9 months ago

0.11.2-rc.1

1 year ago

0.11.2-rc.2

1 year ago

0.11.2-rc.0

1 year ago

0.11.1-rc.0

1 year ago

0.11.1

1 year ago

0.10.2

1 year ago

0.10.3

1 year ago

0.10.4

1 year ago

0.10.0

1 year ago

0.10.0-rc.4

1 year ago

0.10.0-rc.3

1 year ago

0.10.0-rc.2

1 year ago

0.10.0-rc.1

1 year ago

0.9.0

1 year ago

0.9.1

1 year ago

0.9.0-rc.2

1 year ago

0.9.0-rc.1

1 year ago

0.8.0

1 year ago

0.8.0-rc.1

1 year ago

0.8.0-rc.0

1 year ago