Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

855 B
Raw Blame
"use strict";

var path = require("node:path").posix;
var helpers = require("../helpers.cjs");
var runMochaJSON = helpers.runMochaJSON;

describe("--async-only", function () {
  var args = [];

  before(function () {
    args = ["--async-only"];
  });

  it("should fail synchronous specs", function (done) {
    var fixture = path.join("options", "async-only-sync.fixture.js");
    runMochaJSON(fixture, args, function (err, res) {
      if (err) {
        return done(err);
      }

      expect(res, "to have failed");
      done();
    });
  });

  it("should allow asynchronous specs", function (done) {
    var fixture = path.join("options", "async-only-async.fixture.js");
    runMochaJSON(fixture, args, function (err, res) {
      if (err) {
        return done(err);
      }

      expect(res, "to have passed");
      done();
    });
  });
});