Skip to content

Commit 25ce314

Browse files
committed
rename callThought->callThrough
1 parent bd72882 commit 25ce314

9 files changed

Lines changed: 21 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ I have wrote some articles about these ideas - https://medium.com/tag/rewiremock
4343
- .with(stubs: function | Object) - overloads module with a value
4444
- .withDefault(stub: function | Object) - overload `default` es6 export
4545
- .by(otherModule: string) - overload by another module
46-
- .callThought() - first load original module, and next extend it by provided stub.
46+
- .callThrough() - first load original module, and next extend it by provided stub.
4747
- .toBeUsed() - enables usage checking.
4848
- .directChildOnly - will do mock only direct dependencies.
4949
- .calledFromMock - will do mock only dependencies of mocked dependencies.
@@ -81,7 +81,7 @@ First - define your mocks. You can do it in any place, this is just a setup.
8181

8282
// replace only part of some library and keep the rest
8383
rewiremock('someLibrary')
84-
.callThought()
84+
.callThrough()
8585
.with({
8686
onlyOneMethod
8787
})

_tests/es6.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ describe('es6 modules ', () => {
5959
_clearPlugins();
6060
});
6161

62-
it('should fail with callThought: ', () => {
62+
it('should fail with callThrough: ', () => {
6363
addPlugin(relativePlugin);
6464
rewiremock('./foo')
65-
.callThought()
65+
.callThrough()
6666
.with(()=>'aa');
6767

6868
rewiremock('./bar')
@@ -84,10 +84,10 @@ describe('es6 modules ', () => {
8484
_clearPlugins();
8585
});
8686

87-
it('should fail with callThought: ', () => {
87+
it('should fail with callThrough: ', () => {
8888
addPlugin(relativePlugin);
8989
rewiremock('./foo')
90-
.callThought()
90+
.callThrough()
9191
.withDefault(()=>'aa');
9292

9393
rewiremock('./bar')

_tests/isolation.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('isolation ', () => {
8585
addPlugin(nodePlugin);
8686
rewiremock.passBy(/node_modules/);
8787
rewiremock('./lib/c/bar')
88-
.callThought();
88+
.callThrough();
8989

9090
rewiremock.enable();
9191
rewiremock.isolation();
@@ -101,7 +101,7 @@ describe('isolation ', () => {
101101
addPlugin(nodePlugin);
102102
rewiremock.passBy(/node_modules/);
103103
rewiremock('./lib/c/bar')
104-
.callThought();
104+
.callThrough();
105105

106106
rewiremock.enable();
107107
rewiremock.isolation({

_tests/mock.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('rewiremock ', () => {
134134
addPlugin(relativePlugin);
135135

136136
rewiremock('./foo')
137-
.callThought()
137+
.callThrough()
138138
.by(({original}) => {
139139
return () => "~" + original() + '~'
140140
});
@@ -177,15 +177,15 @@ describe('rewiremock ', () => {
177177
.then(mocked => expect(mocked()).to.be.equal('>+!mock'));
178178
});
179179

180-
it('should mock all due to callthought mocked : ', () => {
180+
it('should mock all due to callThrough mocked : ', () => {
181181
return rewiremock.around(() => require('./lib/c/barbaz.js'),
182182
() => {
183183
//addPlugin(nodePlugin);
184184
rewiremock('./baz')
185185
.with(() => 'mock')
186186
.calledFromMock();
187187
rewiremock('./bar')
188-
.callThought();
188+
.callThrough();
189189
})
190190
.then(mocked => expect(mocked()).to.be.equal('>+mockmock'));
191191
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rewiremock",
3-
"version": "1.3.9",
3+
"version": "2.0.0",
44
"description": "Easy and es6 compatible dependency mocking tool.",
55
"main": "lib/index.js",
66
"module": "src/index.js",

rewiremock.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface ModuleMock {
99
/**
1010
* Enabled call thought original module
1111
*/
12-
callThought(): ModuleMock,
12+
callThrough(): ModuleMock,
1313

1414
/**
1515
* Setting es6 bahavior for a module
@@ -85,7 +85,7 @@ interface rewiremock {
8585

8686
/**
8787
* Activates module isolation
88-
* @param {Boolean} [options.noAutoPassBy] includes mocked modules to a isolation scope. Usage with mock.callThought.
88+
* @param {Boolean} [options.noAutoPassBy] auto-includes mocked modules passBy list.
8989
*/
9090
isolation(options?: Object): rewiremock;
9191

src/executor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function mockLoader(request, parent, isMain) {
7171

7272
mockedModules[baseRequest] = true;
7373

74-
if (mock.allowCallThought) {
74+
if (mock.allowCallThrough) {
7575
if (!mock.original) {
7676
mock.original = originalLoader(request, parent, isMain);
7777
}
@@ -93,15 +93,15 @@ function mockLoader(request, parent, isMain) {
9393
return mockResult(request, mock.override);
9494
}
9595

96-
if (mock.allowCallThought) {
96+
if (mock.allowCallThrough) {
9797
if(typeof(mock.original) === 'function') {
9898
if (
9999
typeof mock.value === 'object' &&
100100
Object.keys(mock.value).length === 0
101101
) {
102102
return mockResult(request, mock.original);
103103
} else {
104-
throw new Error('rewiremock: trying to merge Functional base with CallThought mock at '
104+
throw new Error('rewiremock: trying to merge Functional base with callThrough mock at '
105105
+ request + '. Use overrideBy instead.');
106106
}
107107
}

src/mock.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class ModuleMock {
99

1010
/**
1111
* Enabled call thought original module
12-
* @name ModuleMock.callThought
12+
* @name ModuleMock.callThrough
1313
* @return {ModuleMock}
1414
*/
15-
callThought() {
16-
this.mock.allowCallThought = true;
15+
callThrough() {
16+
this.mock.allowCallThrough = true;
1717
return this;
1818
}
1919

src/mockModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mockModule.resolve = (module) => {
5353
/**
5454
* Activates module isolation
5555
* @param {Object} [options]
56-
* @param {Boolean} [options.noAutoPassBy] includes mocked modules to a isolation scope. Usage with mock.callThought.
56+
* @param {Boolean} [options.noAutoPassBy] includes mocked modules to a isolation scope. Usage with mock.callThrough.
5757
*/
5858
mockModule.isolation = (options = {}) => {
5959
mockScope.isolation = { ...options };

0 commit comments

Comments
 (0)