npm.io
14.4.0 • Published 11 months ago

@talend/scripts-config-jest

Licence
Apache-2.0
Version
14.4.0
Deps
11
Size
19 kB
Vulns
0
Weekly
0
Stars
159

Jest config customisation

To use the jest configuration in your IDE, or to add customisation

  1. Create an jest.config.js at your project root folder
  2. Make it extend the one from talend preset
const defaults = require('@talend/scripts-config-jest');

module.exports = {
	...defaults,

	// add/change default config here
};

how stop ignore transform over packages in node_modules

because jest support of ECMAPScriptModules is experiemental we have added possibilities to apply transforms on modules. Since d3 7.x library use ECMAPScriptModules in it's package.json as main entry point it break jest with this kind of errors:

node_modules/d3-scale/src/index.js:1
export {
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

You may encounter in your project the need to add other modules than just d3. To do so we provide to you the following API:

// your project's jest.config.js
const config = require('@talend/scripts-config-jest/jest.config.js');
const testUtils = require('@talend/scripts-config-jest/utils');

testUtils.applyBabelTransformOn(config, ['dexie']);

module.exports = config;