Skip to content

Commit

Permalink
Export Jest's default options (#5948)
Browse files Browse the repository at this point in the history
* Export Jest's default options

* Improve require('jest-config')

* Add "Export Jest's default options" to changelog
  • Loading branch information
tkrotoff authored and cpojer committed Apr 9, 2018
1 parent 118f936 commit 6c8aafc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Features

* `[jest-config]` Export Jest's default options
([#5948](https://github.com/facebook/jest/pull/5948))
* `[jest-editor-support]` Move `coverage` to `ProjectWorkspace.collectCoverage`
([#5929](https://github.com/facebook/jest/pull/5929))
* `[jest-editor-support]` Add `coverage` option to runner
Expand Down
14 changes: 14 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ These options let you control Jest's behavior in your `package.json` file. The
Jest philosophy is to work great by default, but sometimes you just need more
configuration power.

### Defaults

You can retrieve Jest's default options to expand them if needed:

```js
// jest.config.js
const {defaults} = require('jest-config');
module.exports = {
// ...
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
// ...
};
```

<AUTOGENERATED_TABLE_OF_CONTENTS>

---
Expand Down
5 changes: 5 additions & 0 deletions packages/jest-config/src/__tests__/defaults.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {defaults} from '../index';

test('get configuration defaults', () => {
expect(defaults).toBeDefined();
});
1 change: 1 addition & 0 deletions packages/jest-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export {getTestEnvironment, isJSONString} from './utils';
export {default as normalize} from './normalize';
export {default as deprecationEntries} from './deprecated';
export {replaceRootDirInPath} from './utils';
export {default as defaults} from './defaults';

export function readConfig(
argv: Argv,
Expand Down

0 comments on commit 6c8aafc

Please sign in to comment.