Skip to content

Commit

Permalink
add example using babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 17, 2018
1 parent 3dd29cd commit 65f01e2
Show file tree
Hide file tree
Showing 13 changed files with 659 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Chore & Maintenance

- `[docs]` Fix babel-core installation instructions ([#6745](https://github.com/facebook/jest/pull/6745))
- `[examples]` add example using Babel 7 ([#6983](https://github.com/facebook/jest/pull/6983))

### Chore & Maintenance

Expand Down
2 changes: 2 additions & 0 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ yarn add --dev babel-jest babel-core regenerator-runtime
> ```bash
> yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
9 changes: 9 additions & 0 deletions examples/babel-7/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.

'use strict';

import {double} from '../index';

it('works with `import`', () => {
expect(double(5)).toBe(10);
});
5 changes: 5 additions & 0 deletions examples/babel-7/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
presets: ['@babel/preset-env'],
};
5 changes: 5 additions & 0 deletions examples/babel-7/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2004-present Facebook. All Rights Reserved.

export function double(input) {
return input * 2;
}
15 changes: 15 additions & 0 deletions examples/babel-7/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"private": true,
"version": "0.0.0",
"name": "example-babel-7",
"devDependencies": {
"@babel/core": "*",
"@babel/preset-env": "*",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "*",
"jest": "*"
},
"scripts": {
"test": "jest"
}
}
2 changes: 2 additions & 0 deletions website/versioned_docs/version-22.0/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ npm install --save-dev babel-jest babel-core regenerator-runtime
> ```bash
> npm install --save-dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-22.1/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ npm install --save-dev babel-jest babel-core regenerator-runtime
> ```bash
> npm install --save-dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-22.2/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ npm install --save-dev babel-jest babel-core regenerator-runtime
> ```bash
> npm install --save-dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-22.3/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ npm install --save-dev babel-jest babel-core regenerator-runtime
> ```bash
> npm install --save-dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-22.4/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ yarn add --dev babel-jest babel-core regenerator-runtime
> ```bash
> yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-23.2/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ yarn add --dev babel-jest babel-core regenerator-runtime
> ```bash
> yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
> ```
>
> You can also see the example in the Jest repository: https://github.com/facebook/jest/tree/master/examples/babel-7
_Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_

Expand Down

0 comments on commit 65f01e2

Please sign in to comment.