Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Support Jest customizations #475

Open
lassedamgaard opened this issue Aug 16, 2018 · 2 comments
Open

Support Jest customizations #475

lassedamgaard opened this issue Aug 16, 2018 · 2 comments

Comments

@lassedamgaard
Copy link
Contributor

Type of issue

Feature request

Description

We are using plain Jest for our tests and would like to add extensions via the setupTestFrameworkScriptFile config option. For example the jest-extended package of additional matchers. It doesn't seem like that is currently possible.

Current behavior

fusion-cli configures Jest and only certain params can be modified via args to the test cmd.

Ideal behavior

We would like to either
(1) just have setupTestFrameworkScriptFile supported as an option for the test cmd the same way a limited number of other options can be controlled, or
(2) have a way to pass in (e.g. as a file reference) a fully blown Jest config with the test task that would then be merged in with the Jest config that comes built in with fusion-cli.

@KevinGrandon
Copy link
Contributor

Thanks for the bug report. We are currently considering allowing for customization of the jest config, but nothing is on the roadmap yet. I'm wondering if we can come up with a decent workaround for you in the meantime. Is it possible to have require('jest-extended'); in test files for the time being?

@VigneshPeriasami
Copy link

VigneshPeriasami commented Sep 14, 2018

A workaround that I found to merge fusion cli jest config, it is not fusion-cli recommended way, but works for now.

In project root jest.config.js

const fusionJestConfig = require('fusion-cli/build/jest/jest-config');

fusionJestConfig.projects = fusionJestConfig.projects.map((config) => {
  return {
    ...config,
    setupFiles: [...config.setupFiles, '<rootDir>/src/test/test-setup.js']
  };
});

module.exports = fusionJestConfig;

package.json

"test": 'fusion test --configPath ./jest.config.js"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants