Skip to content

Commit ab09c2e

Browse files
committed
Fix for #305
1 parent e85fda6 commit ab09c2e

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

tasks/modules/optionsResolver.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tasks/modules/optionsResolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ function resolveAndWarnOnConfigurationIssues(task: ITargetOptions,
129129

130130
function getAdditionalWarnings(task: any, target: any, targetName: string) {
131131
const additionalWarnings = [];
132-
if (((task && task.src) || (target && target.src)) &&
132+
133+
if (((task && task.src && targetName !== 'src') || (target && target.src)) &&
133134
((task && task.files) || (target && target.files))) {
134135
additionalWarnings.push(`Warning: In task "${targetName}", either "files" or "src" should be used - not both.`);
135136
}
@@ -139,7 +140,6 @@ function resolveAndWarnOnConfigurationIssues(task: ITargetOptions,
139140
additionalWarnings.push(`Warning: In task "${targetName}", either "files" or "vs" should be used - not both.`);
140141
}
141142

142-
143143
if (usingDestArray(task) || usingDestArray(target)) {
144144
additionalWarnings.push(`Warning: target "${targetName}" has an array specified for the files.dest property.` +
145145
` This is not supported. Taking first element and ignoring the rest.`);

test/optionsResolverTests.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/optionsResolverTests.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ const config : {[name: string]: IGruntTargetOptions} = {
8888
"reference set to undefined": <any>{
8989
reference: undefined
9090
},
91+
"files minimalist": <any>{
92+
files: [{
93+
src: "source/**/*.ts",
94+
dest: "build"
95+
}]
96+
},
9197
"vs minimalist": <any>{
9298
vs: "test/vsproj/testproject.csproj"
9399
},
@@ -192,6 +198,18 @@ export var tests : nodeunit.ITestGroup = {
192198
test.ok(allWarnings.indexOf('It is also the wrong case and should be sourceMap') > -1);
193199
test.done();
194200
}).catch((err) => {test.ifError(err); test.done();});
201+
},
202+
"No warning on target named src that uses files": (test: nodeunit.Test) => {
203+
test.expect(1);
204+
205+
const cfg = getConfig("files minimalist", true);
206+
const fakeTask: any = {src: {}};
207+
const result = or.resolveAsync(fakeTask, cfg, "src").then((result) => {
208+
let allWarnings = result.warnings.join('\n');
209+
console.log(allWarnings);
210+
test.strictEqual(allWarnings.length, 0, "expected no warnings.");
211+
test.done();
212+
}).catch((err) => {test.ifError(err); test.done();});
195213
}
196214
},
197215

0 commit comments

Comments
 (0)