Coder Social home page Coder Social logo

jest-preset-sw6-admin's Introduction

Jest Test preset for Shopware 6 administration unit tests

GitHub GitHub last commit Libraries.io Latest version

Default Jest preset for Shopware 6 administration development.

npm install jest @shopware-ag/jest-preset-sw6-admin @babel/preset-env @babel/plugin-proposal-class-properties --save-dev

Setup

After installaing the necessary required packages, please create a file called babel.config.json right next to your own package.json with the following content:

{
    "presets": ["@babel/preset-env"],
    "plugins": ["@babel/plugin-proposal-class-properties"]
}

Via jest.config.js

Next up, create a file jest.config.js which should contain the following content:

module.exports = {
    preset: '@shopware-ag/jest-preset-sw6-admin',
    globals: {
        adminPath: '<file-path-to-sw6-administration>', // required, e.g. /www/sw6/platform/src/Administration/Resources/app/administration
    }
}

Options the preset sets up for you

  • collectCoverage - Code coverage will be generated using the reporters listed under coverageReporters
  • coverageReporters - The presets uses lcov, text & clover as coverage reporters
  • watchPathIgnorePatterns - Ignores the node_modules folder for the watch mode of Jest
  • clearMocks - Automatically clear mock calls and instances before every test.
  • moduleFileExtensions - File with the extension js will automatically used as extensions your module use.
  • moduleNameMapper - All css, less & scss files will be mocked and relative paths to src are getting mapped to the correct src directory
  • transform - Transforms js files using babel-jest and twig files are transformed using a custom twig transformer which we use in the administration as well
  • modulePathIgnorePatterns - Ignores e2e test specs by default
  • setupFilesAfterEnv - Provides a polyfill for Webpack' require.context and sets up the global Shopware third-party interface for every test. The object can be accessed using global.Shopware in test files.
  • testMatch - Matches all files containing .spec.js in the test directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.