Skip to content

Commit

Permalink
feat: Add require.requireActual and require.requireMock to the list o…
Browse files Browse the repository at this point in the history
…f transformed Jest functions (#227)
  • Loading branch information
fatfisz committed Oct 30, 2017
1 parent a7c04b0 commit 47fd5ba
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/tleunen/babel-plugin-module-resolver.git"
},
"engines": {
"node" : ">= 6.0.0"
"node": ">= 6.0.0"
},
"files": [
"lib"
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -23,6 +23,7 @@ const visitor = {

export default ({ types }) => ({
name: 'module-resolver',

pre(file) {
this.types = types;

Expand Down
4 changes: 4 additions & 0 deletions src/normalizeOptions.js
Expand Up @@ -14,12 +14,16 @@ const defaultTransformedFunctions = [
'require',
'require.resolve',
'System.import',

// Jest methods
'jest.genMockFromModule',
'jest.mock',
'jest.unmock',
'jest.doMock',
'jest.dontMock',
'jest.setMock',
'require.requireActual',
'require.requireMock',
];

function isRegExp(string) {
Expand Down
2 changes: 2 additions & 0 deletions test/call.test.js
Expand Up @@ -13,6 +13,8 @@ const calls = [
'jest.doMock',
'jest.dontMock',
'jest.setMock',
'require.requireActual',
'require.requireMock',
];

describe('function and method calls', () => {
Expand Down

0 comments on commit 47fd5ba

Please sign in to comment.