• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gulpjs / gulp-cli / 15379317059

01 Jun 2025 08:53PM UTC coverage: 97.865%. Remained the same
15379317059

push

github

web-flow
chore: release 3.1.0 (#273)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

314 of 335 branches covered (93.73%)

596 of 609 relevant lines covered (97.87%)

122.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.11
/lib/versioned/%5E4.0.0/index.js
1
'use strict';
2

3
var fs = require('fs');
110✔
4

5
var log = require('gulplog');
110✔
6
var stdout = require('mute-stdout');
110✔
7
var messages = require('@gulpjs/messages');
110✔
8

9
var exit = require('../../shared/exit');
110✔
10

11
var logTasks = require('../../shared/log/tasks');
110✔
12
var logEvents = require('./log/events');
110✔
13
var logSyncTask = require('./log/sync-task');
110✔
14
var normalizeError = require('./normalize-error');
110✔
15
var logTasksSimple = require('./log/tasks-simple');
110✔
16
var registerExports = require('../../shared/register-exports');
110✔
17

18
var copyTree = require('../../shared/log/copy-tree');
110✔
19
var getTask = require('./log/get-task');
110✔
20
var requireOrImport = require('../../shared/require-or-import');
110✔
21

22
function execute(env, opts, translate) {
23
  var tasks = opts._;
110✔
24
  var toRun = tasks.length ? tasks : ['default'];
110✔
25

26
  if (opts.tasksSimple || opts.tasks || opts.tasksJson) {
110✔
27
    // Mute stdout if we are listing tasks
28
    stdout.mute();
31✔
29
  }
30

31
  var gulpInst = require(env.modulePath);
110✔
32
  logEvents(gulpInst);
110✔
33
  logSyncTask(gulpInst, opts);
110✔
34

35
  // This is what actually loads up the gulpfile
36
  requireOrImport(env.configPath, function(err, exported) {
110✔
37
    // Before import(), if require() failed we got an unhandled exception on the module level.
38
    // So console.error() & exit() were added here to mimic the old behavior as close as possible.
39
    if (err) {
110✔
40
      console.error(err);
2✔
41
      exit(1);
2✔
42
    }
43

44
    registerExports(gulpInst, exported);
108✔
45

46
    // Always unmute stdout after gulpfile is required
47
    stdout.unmute();
108✔
48

49
    var tree;
50
    if (opts.tasksSimple) {
108✔
51
      tree = gulpInst.tree();
2✔
52
      return logTasksSimple(tree.nodes);
2✔
53
    }
54
    if (opts.tasks) {
106✔
55
      tree = gulpInst.tree({ deep: true });
24✔
56
      tree.label = translate.message({ tag: messages.DESCRIPTION, path: env.configPath });
24✔
57

58
      return logTasks(tree, opts, getTask(gulpInst), translate);
24✔
59
    }
60
    if (opts.tasksJson) {
82✔
61
      tree = gulpInst.tree({ deep: true });
5✔
62
      tree.label = translate.message({ tag: messages.DESCRIPTION, path: env.configPath });
5✔
63

64
      var output = JSON.stringify(copyTree(tree, opts));
5✔
65

66
      if (typeof opts.tasksJson === 'boolean' && opts.tasksJson) {
5✔
67
        return console.log(output);
4✔
68
      }
69
      return fs.writeFileSync(opts.tasksJson, output, 'utf-8');
1✔
70
    }
71
    try {
77✔
72
      log.info({ tag: messages.GULPFILE, path: env.configPath });
77✔
73
      var runMethod = opts.series ? 'series' : 'parallel';
77✔
74
      gulpInst[runMethod](toRun)(function(err) {
77✔
75
        if (err) {
70✔
76
          exit(1);
11✔
77
        }
78
      });
79
    } catch (err) {
80
      normalizeError(err);
3✔
81
      if (err.task) {
3!
82
        log.error({ tag: messages.TASK_MISSING, task: err.task, similar: err.similar });
3✔
83
      } else {
84
        log.error({ tag: messages.EXEC_ERROR, message: err.message, error: err });
×
85
      }
86
      exit(1);
3✔
87
    }
88
  });
89
}
90

91
module.exports = execute;
110✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc