Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(grunt) {
grunt.file.setBase('../fixtures/load-npm-tasks');
// Create a custom log to assert output
var stdout = [];
var oldlog = grunt.log;
var stream = through(function(data, enc, next) {
stdout.push(data.toString());
next(null, data);
});
stream.pipe(process.stdout);
var log = new Log({
grunt: grunt,
outStream: stream,
});
grunt.log = log;
// Load a npm task
grunt.loadNpmTasks('grunt-foo-plugin');
// Run them
grunt.registerTask('default', ['foo', 'done']);
// Assert they loaded and ran correctly
grunt.registerTask('done', function() {
grunt.log = oldlog;
stdout = stdout.join('\n');
try {
require('coffee-script');
// The module to be exported.
var grunt = module.exports = {};
// Expose internal grunt libs.
function gRequire(name) {
return grunt[name] = require('./grunt/' + name);
}
var util = require('grunt-legacy-util');
grunt.util = util;
grunt.util.task = require('./util/task');
var Log = require('grunt-legacy-log').Log;
var log = new Log({grunt: grunt});
grunt.log = log;
gRequire('template');
gRequire('event');
var fail = gRequire('fail');
gRequire('file');
var option = gRequire('option');
var config = gRequire('config');
var task = gRequire('task');
var help = gRequire('help');
gRequire('cli');
var verbose = grunt.verbose = log.verbose;
// Expose some grunt metadata.
grunt.package = require('../package.json');
grunt.version = grunt.package.version;
require('coffee-script/register');
// The module to be exported.
var grunt = module.exports = {};
// Expose internal grunt libs.
function gRequire(name) {
return grunt[name] = require('./grunt/' + name);
}
var util = require('grunt-legacy-util');
grunt.util = util;
grunt.util.task = require('./util/task');
var Log = require('grunt-legacy-log').Log;
var log = new Log({grunt: grunt});
grunt.log = log;
gRequire('template');
gRequire('event');
var fail = gRequire('fail');
gRequire('file');
var option = gRequire('option');
var config = gRequire('config');
var task = gRequire('task');
var help = gRequire('help');
gRequire('cli');
var verbose = grunt.verbose = log.verbose;
// Expose some grunt metadata.
grunt.package = require('../package.json');
grunt.version = grunt.package.version;
require('coffeescript/register');
// The module to be exported.
var grunt = module.exports = {};
// Expose internal grunt libs.
function gRequire(name) {
return grunt[name] = require('./grunt/' + name);
}
var util = require('grunt-legacy-util');
grunt.util = util;
grunt.util.task = require('./util/task');
var Log = require('grunt-legacy-log').Log;
var log = new Log({grunt: grunt});
grunt.log = log;
gRequire('template');
gRequire('event');
var fail = gRequire('fail');
gRequire('file');
var option = gRequire('option');
var config = gRequire('config');
var task = gRequire('task');
var help = gRequire('help');
gRequire('cli');
var verbose = grunt.verbose = log.verbose;
// Expose some grunt metadata.
grunt.package = require('../package.json');
grunt.version = grunt.package.version;