0.11.2-rc.2 • Published 8 months ago

@discord/jest-processor-discord-intl v0.11.2-rc.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 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.11.2-rc.1

8 months ago

0.11.2-rc.2

8 months ago

0.11.2-rc.0

8 months ago

0.11.1-rc.0

8 months ago

0.11.1

8 months ago

0.10.2

8 months ago

0.10.3

8 months ago

0.10.4

8 months ago

0.10.0

8 months ago

0.10.0-rc.4

8 months ago

0.10.0-rc.3

8 months ago

0.10.0-rc.2

8 months ago

0.10.0-rc.1

8 months ago

0.9.0

8 months ago

0.9.1

8 months ago

0.9.0-rc.2

8 months ago

0.9.0-rc.1

8 months ago

0.8.0

8 months ago

0.8.0-rc.1

8 months ago

0.8.0-rc.0

8 months ago