quackage 1.0.63 → 1.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ class QuackageCommandBuild extends libCommandLineCommand
|
|
|
19
19
|
onRunAsync(fCallback)
|
|
20
20
|
{
|
|
21
21
|
// See if the user passed in a filter for tests
|
|
22
|
-
let tmpTestGrepExpression = (typeof(this.CommandOptions.
|
|
22
|
+
let tmpTestGrepExpression = (typeof(this.CommandOptions.grep) === 'undefined') ? false : this.CommandOptions.grep;
|
|
23
23
|
|
|
24
24
|
let tmpCWDMochaLocation = `${this.fable.AppData.CWD}/node_modules/.bin/mocha`;
|
|
25
25
|
let tmpRelativePackageMochaLocation = `${__dirname}/../../../.bin/mocha`;
|
|
@@ -336,39 +336,67 @@ ${tmpExampleListItems} </ul>
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
let tmpNpxLocation = this.resolveExecutable('npx');
|
|
339
|
+
let tmpNpmLocation = this.resolveExecutable('npm');
|
|
339
340
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
{
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (tmpPackage.copyFiles || tmpPackage.copyFilesSettings)
|
|
341
|
+
// Install dependencies if node_modules does not exist
|
|
342
|
+
let tmpNodeModulesPath = libPath.join(pExample.Path, 'node_modules');
|
|
343
|
+
let tmpRunBuild = () =>
|
|
344
|
+
{
|
|
345
|
+
this.fable.QuackageProcess.execute(
|
|
346
|
+
tmpNpxLocation,
|
|
347
|
+
['quack', 'build'],
|
|
348
|
+
{ cwd: pExample.Path },
|
|
349
|
+
(pBuildError) =>
|
|
352
350
|
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
351
|
+
if (pBuildError)
|
|
352
|
+
{
|
|
353
|
+
this.log.error(`Build error in [${pExample.Name}]: ${pBuildError.message}`);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (tmpPackage.copyFiles || tmpPackage.copyFilesSettings)
|
|
357
|
+
{
|
|
358
|
+
this.log.info(`Copying files for [${pExample.Name}] ...`);
|
|
359
|
+
this.fable.QuackageProcess.execute(
|
|
360
|
+
tmpNpxLocation,
|
|
361
|
+
['quack', 'copy'],
|
|
362
|
+
{ cwd: pExample.Path },
|
|
363
|
+
(pCopyError) =>
|
|
361
364
|
{
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
if (pCopyError)
|
|
366
|
+
{
|
|
367
|
+
this.log.error(`Copy error in [${pExample.Name}]: ${pCopyError.message}`);
|
|
368
|
+
}
|
|
369
|
+
return fExampleCallback();
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
else
|
|
373
|
+
{
|
|
374
|
+
return fExampleCallback();
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
if (!libFS.existsSync(tmpNodeModulesPath))
|
|
380
|
+
{
|
|
381
|
+
this.log.info(`Installing dependencies for [${pExample.Name}] ...`);
|
|
382
|
+
this.fable.QuackageProcess.execute(
|
|
383
|
+
tmpNpmLocation,
|
|
384
|
+
['install'],
|
|
385
|
+
{ cwd: pExample.Path },
|
|
386
|
+
(pInstallError) =>
|
|
368
387
|
{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
388
|
+
if (pInstallError)
|
|
389
|
+
{
|
|
390
|
+
this.log.error(`Install error in [${pExample.Name}]: ${pInstallError.message}`);
|
|
391
|
+
return fExampleCallback();
|
|
392
|
+
}
|
|
393
|
+
tmpRunBuild();
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
else
|
|
397
|
+
{
|
|
398
|
+
tmpRunBuild();
|
|
399
|
+
}
|
|
372
400
|
},
|
|
373
401
|
(pError) =>
|
|
374
402
|
{
|
package/test/Quackage_tests.js
CHANGED
|
@@ -210,6 +210,38 @@ suite
|
|
|
210
210
|
Expect(tmpClass.prototype.onRunAsync).to.be.a('function');
|
|
211
211
|
}
|
|
212
212
|
);
|
|
213
|
+
|
|
214
|
+
test
|
|
215
|
+
(
|
|
216
|
+
'RunMochaTests command should have a --grep option registered.',
|
|
217
|
+
function()
|
|
218
|
+
{
|
|
219
|
+
let tmpCommand = getCommand('run-mocha-tests');
|
|
220
|
+
Expect(tmpCommand).to.be.an('object');
|
|
221
|
+
|
|
222
|
+
// Verify the --grep option is registered on the commander command
|
|
223
|
+
let tmpGrepOption = tmpCommand.options.find((pOpt) => pOpt.long === '--grep');
|
|
224
|
+
Expect(tmpGrepOption).to.be.an('object', 'Expected --grep option to be registered on run-mocha-tests command');
|
|
225
|
+
Expect(tmpGrepOption.short).to.equal('-g');
|
|
226
|
+
Expect(tmpGrepOption.optional).to.equal(true, 'grep should accept an optional value');
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
test
|
|
231
|
+
(
|
|
232
|
+
'RunMochaTests --grep option property name should match what onRunAsync reads.',
|
|
233
|
+
function()
|
|
234
|
+
{
|
|
235
|
+
let tmpCommand = getCommand('run-mocha-tests');
|
|
236
|
+
let tmpGrepOption = tmpCommand.options.find((pOpt) => pOpt.long === '--grep');
|
|
237
|
+
|
|
238
|
+
// Commander derives the property name from the long flag (--grep => "grep").
|
|
239
|
+
// onRunAsync reads this.CommandOptions.grep to get the expression.
|
|
240
|
+
// This test ensures the two stay in sync — the bug was that onRunAsync
|
|
241
|
+
// previously read "search_expression" (the placeholder name) instead of "grep".
|
|
242
|
+
Expect(tmpGrepOption.attributeName()).to.equal('grep');
|
|
243
|
+
}
|
|
244
|
+
);
|
|
213
245
|
}
|
|
214
246
|
);
|
|
215
247
|
|