Skip to content

Commit 018b276

Browse files
committed
bug #102 Fix missing tsloader return statement (ldiringer)
This PR was squashed before being merged into the master branch (closes #102). Discussion ---------- Fix missing tsloader return statement This commit (35d9e6f#diff-168726dbe96b3ce427e7fedce31bb0bc) removed inadvertently the `return this;` statement from the `enableTypeScriptLoader` function. This prevents calling another function chained on `enableTypeScriptLoader` in a `webpack.config.js` file. This PR just puts the `return this;` statement back. Commits ------- 51cf2ab Fix missing tsloader return statement
2 parents 9c5557d + 51cf2ab commit 018b276

File tree

2 files changed

+208
-0
lines changed

2 files changed

+208
-0
lines changed

index.js

+2
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ module.exports = {
372372
*/
373373
enableTypeScriptLoader(callback = () => {}) {
374374
webpackConfig.enableTypeScriptLoader(callback);
375+
376+
return this;
375377
},
376378

377379
/**

test/index.js

+206
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
'use strict';
11+
12+
const expect = require('chai').expect;
13+
require('../lib/context').runtimeConfig = {};
14+
const api = require('../index');
15+
16+
describe('Public API', () => {
17+
18+
describe('setOutputPath', () => {
19+
20+
it('must return the API object', () => {
21+
const returnedValue = api.setOutputPath('/');
22+
expect(returnedValue).to.equal(api);
23+
});
24+
25+
});
26+
27+
describe('setPublicPath', () => {
28+
29+
it('must return the API object', () => {
30+
const returnedValue = api.setPublicPath('/');
31+
expect(returnedValue).to.equal(api);
32+
});
33+
34+
});
35+
36+
describe('setManifestKeyPrefix', () => {
37+
38+
it('must return the API object', () => {
39+
const returnedValue = api.setManifestKeyPrefix('/build');
40+
expect(returnedValue).to.equal(api);
41+
});
42+
43+
});
44+
45+
describe('addEntry', () => {
46+
47+
it('must return the API object', () => {
48+
const returnedValue = api.addEntry('entry', 'main.js');
49+
expect(returnedValue).to.equal(api);
50+
});
51+
52+
});
53+
54+
describe('addStyleEntry', () => {
55+
56+
it('must return the API object', () => {
57+
const returnedValue = api.addStyleEntry('styleEntry', 'main.css');
58+
expect(returnedValue).to.equal(api);
59+
});
60+
61+
});
62+
63+
describe('addPlugin', () => {
64+
65+
it('must return the API object', () => {
66+
const returnedValue = api.addPlugin(null);
67+
expect(returnedValue).to.equal(api);
68+
});
69+
70+
});
71+
72+
describe('addLoader', () => {
73+
74+
it('must return the API object', () => {
75+
const returnedValue = api.addLoader(null);
76+
expect(returnedValue).to.equal(api);
77+
});
78+
79+
});
80+
81+
describe('addRule', () => {
82+
83+
it('must return the API object', () => {
84+
const returnedValue = api.addRule(null);
85+
expect(returnedValue).to.equal(api);
86+
});
87+
88+
});
89+
90+
describe('enableVersioning', () => {
91+
92+
it('must return the API object', () => {
93+
const returnedValue = api.enableVersioning();
94+
expect(returnedValue).to.equal(api);
95+
});
96+
97+
});
98+
99+
describe('enableSourceMaps', () => {
100+
101+
it('must return the API object', () => {
102+
const returnedValue = api.enableSourceMaps();
103+
expect(returnedValue).to.equal(api);
104+
});
105+
106+
});
107+
108+
describe('createSharedEntry', () => {
109+
110+
it('must return the API object', () => {
111+
const returnedValue = api.createSharedEntry('sharedEntry', 'vendor.js');
112+
expect(returnedValue).to.equal(api);
113+
});
114+
115+
});
116+
117+
describe('autoProvideVariables', () => {
118+
119+
it('must return the API object', () => {
120+
const returnedValue = api.autoProvideVariables({});
121+
expect(returnedValue).to.equal(api);
122+
});
123+
124+
});
125+
126+
describe('autoProvidejQuery', () => {
127+
128+
it('must return the API object', () => {
129+
const returnedValue = api.autoProvidejQuery();
130+
expect(returnedValue).to.equal(api);
131+
});
132+
133+
});
134+
135+
describe('enablePostCssLoader', () => {
136+
137+
it('must return the API object', () => {
138+
const returnedValue = api.enablePostCssLoader();
139+
expect(returnedValue).to.equal(api);
140+
});
141+
142+
});
143+
144+
describe('enableSassLoader', () => {
145+
146+
it('must return the API object', () => {
147+
const returnedValue = api.enableSassLoader();
148+
expect(returnedValue).to.equal(api);
149+
});
150+
151+
});
152+
153+
describe('enableLessLoader', () => {
154+
155+
it('must return the API object', () => {
156+
const returnedValue = api.enableLessLoader();
157+
expect(returnedValue).to.equal(api);
158+
});
159+
160+
});
161+
162+
describe('setOutputPath', () => {
163+
164+
it('must return the API object', () => {
165+
const returnedValue = api.configureBabel(() => {});
166+
expect(returnedValue).to.equal(api);
167+
});
168+
169+
});
170+
171+
describe('enableReactPreset', () => {
172+
173+
it('must return the API object', () => {
174+
const returnedValue = api.enableReactPreset();
175+
expect(returnedValue).to.equal(api);
176+
});
177+
178+
});
179+
180+
describe('enableTypeScriptLoader', () => {
181+
182+
it('must return the API object', () => {
183+
const returnedValue = api.enableTypeScriptLoader();
184+
expect(returnedValue).to.equal(api);
185+
});
186+
187+
});
188+
189+
describe('enableVueLoader', () => {
190+
191+
it('must return the API object', () => {
192+
const returnedValue = api.enableVueLoader();
193+
expect(returnedValue).to.equal(api);
194+
});
195+
196+
});
197+
198+
describe('cleanupOutputBeforeBuild', () => {
199+
200+
it('must return the API object', () => {
201+
const returnedValue = api.cleanupOutputBeforeBuild();
202+
expect(returnedValue).to.equal(api);
203+
});
204+
205+
});
206+
});

0 commit comments

Comments
 (0)