django-apps-jest-mapper

1.0.2 • Public • Published

Django Apps Jest Mapper

Open Source Love license js-semistandard-style package version install size dependecies codecov

Automatically discovery django apps and map jest names for them.

Why?

If you need to start using Jest combined with Webpack on a Django organized project this package can work great together with django-apps-webpack-alias. Static files are usually organized per Django app, and communication between them using relative paths can soon become messy. This way you can generate same Webpack alias for all Django apps automatically and follow the same naming in the jest configuration.

Install

npm i -D django-apps-jest-mapper

Running

const djangoAppsMapper = require('django-apps-jest-mapper');
 
// in jest moduleNameMapper config just spread it (or Object.assign with other entries)
moduleNameMapper: {
    ...djangoAppsMapper({ options })
},

Available options:

  • dir [default 'apps'] path to directory holding the apps
  • prefix [default '@app:'] each app prefix, for instance for auth app it will generate @app:auth

All mappings point to app/static/app/js directory for each app.

License

MIT.

Package Sidebar

Install

npm i django-apps-jest-mapper

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

5.14 kB

Total Files

4

Last publish

Collaborators

  • marinko-peso