Skip to content

Commit

Permalink
more test case of "real world" usage of esm + jest
Browse files Browse the repository at this point in the history
  • Loading branch information
kenotron committed Jan 16, 2019
1 parent 69c6531 commit 541add2
Show file tree
Hide file tree
Showing 5 changed files with 1,167 additions and 797 deletions.
5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module.exports = {
transform: {
'\\.m?js$': 'esm'
'\\.m?jsx?$': 'esm'
},
moduleNameMapper: {
'^anotherRoot/(.*)$': '<rootDir>/lib/anotherRoot/$1'
}
},
transformIgnorePatterns: []
};
5 changes: 3 additions & 2 deletions lib/anotherRoot/bar.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// export default 5;
module.exports.default = function() { return 5; }
export default function() {
return 5;
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
},
"dependencies": {
"esm": "3.1.0",
"enzyme": "3.3.0",
"enzyme-adapter-react-16": "1.1.1",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"react": "16.3.0",
"react-dom": "16.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addBar } from '../../index';
import addBar from '../../index';
import * as bar from 'anotherRoot/bar';

test('addBar should be add five', () => {
Expand Down
Loading

0 comments on commit 541add2

Please sign in to comment.