jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

jake --tasks includes Symbol.for("nodejs.rejection") #374

Closed bradford-fisher closed 4 years ago

bradford-fisher commented 4 years ago

jake is listing a nodejs Symbol defined on EventEmitter as a user defined Task.

Example jakefile

const execSync = require("child_process").execSync;
const desc = require("jake").desc;
const namespace = require("jake").namespace;
const task = require("jake").task;

namespace("main", function()
{
    desc("compile main project");
    task("compile", function()
    {
        tsc("main");
    });
});

namespace("test", function()
{
    desc("compile test project");
    task("compile", function()
    {
        tsc("test");
    });

    desc("run unit tests");
    task("unit", [ "test:compile" ], function()
    {
        teenytest("build/test/**/*.test.js");
    });
});

function teenytest(testPattern)
{
    try
    {
        npx("teenytest", testPattern);
    }
    catch (error)
    {
        // Ignore test failures
    }
}

function tsc(projectName)
{
    npx("tsc", `--build source/${projectName}`);
}

function npx(command, ...arguments)
{
    execute("npx", command, ...arguments);
}

function execute(command, ...arguments)
{
    execSync(
        `${command} ${arguments.join(" ")}`,
        {
            stdio: "inherit",
            windowsHide: true
        }
    );
}

Example output

PS C:\path\to\project> npx jake --tasks
jake main:compile           # compile main project
jake test:compile           # compile test project
jake test:unit              # run unit tests
jake captureRejectionSymbol # nodejs.rejection <-- Problem Here