samedi 28 juillet 2018

meteortesting:mocha does not produce nice output

The recommended testing framework for Meteor 1.7 seems to be meteortesting:mocha.

With a default created app (meteor create my-app), which has the following tests

import assert from "assert";

describe("my-app", function () {
  it("package.json has correct name", async function () {
    const { name } = await import("../package.json");
    assert.strictEqual(name, "noteit");
  });

  if (Meteor.isClient) {
    it("client is not server", function () {
      assert.strictEqual(Meteor.isServer, false);
    });
  }

  if (Meteor.isServer) {
    it("server is not client", function () {
      assert.strictEqual(Meteor.isClient, false);
    });
  }
});

I ran

meteor add meteortesting:mocha
meteor test --driver-package meteortesting:mocha

and got this in the console:

I20180728-12:06:37.729(2)? --------------------------------
I20180728-12:06:37.729(2)? ----- RUNNING SERVER TESTS -----
I20180728-12:06:37.729(2)? --------------------------------
I20180728-12:06:37.729(2)? 
I20180728-12:06:37.730(2)? 
I20180728-12:06:37.731(2)? 
I20180728-12:06:37.737(2)?   the server
    ✓ fails a test.753(2)? 
I20180728-12:06:37.755(2)? 
I20180728-12:06:37.756(2)? 
I20180728-12:06:37.756(2)?   1 passing (26ms)
I20180728-12:06:37.756(2)? 
I20180728-12:06:37.757(2)? Load the app in a browser to run client tests, or set the TEST_BROWSER_DRIVER environment variable. See https://github.com/meteortesting/meteor-mocha/blob/master/README.md#run-app-tests
=> Exited with code: 0
=> Your application is crashing. Waiting for file change.

Actually, it was repeated three times. Not pretty. And I wasn't expecting a passing test to crash my app.

Also in the browser I got this

enter image description here

I was expecting something more like the nice output, as per the Meteor testing guide:

enter image description here

Aucun commentaire:

Enregistrer un commentaire