Skip to content

Tests: #4733

@hzoo

Description

@hzoo

We currently use suite and test instead of describe/it which is more common.

We should switch - can use a codemod cc @DrewML

Example:

suite("bin/" + binName, function () {
_.each(fs.readdirSync(suiteLoc), function (testName) {
if (testName[0] === ".") return;
var testLoc = path.join(suiteLoc, testName);
var opts = {
args: []
};
var optionsLoc = path.join(testLoc, "options.json");
if (pathExists.sync(optionsLoc)) _.merge(opts, require(optionsLoc));
_.each(["stdout", "stdin", "stderr"], function (key) {
var loc = path.join(testLoc, key + ".txt");
if (pathExists.sync(loc)) {
opts[key] = helper.readFile(loc);
} else {
opts[key] = opts[key] || "";
}
});
opts.outFiles = readDir(path.join(testLoc, "out-files"));
opts.inFiles = readDir(path.join(testLoc, "in-files"));
var babelrcLoc = path.join(testLoc, ".babelrc");
if (pathExists.sync(babelrcLoc)) {
// copy .babelrc file to tmp directory
opts.inFiles['.babelrc'] = helper.readFile(babelrcLoc);
}
test(testName, buildTest(binName, testName, opts));

check all packages/*/test

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuehelp wantedoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions