mocha-parallel / mocha-parallel-tests

Parallel test runner for mocha tests. Looking for maintainer.
MIT License
200 stars 45 forks source link

Test output indents horizontally across terminal with each new process #204

Closed createthis closed 5 years ago

createthis commented 5 years ago

Example:

$ npm test

> NODE_ENV=test node_modules/.bin/mocha-parallel-tests --exit --timeout 15000 --full-trace --require babel-core/register

    <Roles />
      getItems
        ✓ returns 1 (213ms)
        ✓ returns 2 (102ms)

          <UserActionLogs />
            getItems
              ✓ returns 1 (153ms)
              ✓ returns 2 (133ms)

              <UserAdd />
                ✓ password requirements help text exists (128ms)
                ✓ loads default state

                  <Datetime />
                    output
                      ✓ displays long date format (45ms)
                      ✓ displays short date format

                        <UserChangePassword />
                          ✓ password requirements help text exists (137ms)
                          ✓ loads default state

Also, these are not complete test outputs. When run synchronously using regular mocha, the test output looks like this:

  <Roles />
    getItems
      ✓ returns 1 (47ms)
      ✓ returns 2

  <UserActionLogs />
    getItems
      ✓ returns 1
      ✓ returns 2
    handleSelect
      ✓ calls props.handleSelect (41ms)
    componentWillReceiveProps
      ✓ calls updateStateData
    buildRows
      ✓ displays "No activity yet" if no emails
      ✓ displays "Loading" if no data

  <UserAdd />
    ✓ password requirements help text exists
    ✓ loads default state
    ✓ loads component with "Add User" (submit) button disabled
    ✓ confirms "too short" password when input < 15 chars
    ✓ confirms "strong" password when input > 15 chars
    ✓ enables "Add User" (submit) button when passwords match
    ✓ displays submit message (52ms)
    ✓ displays submit failure message

  <UserChangePassword />
    ✓ password requirements help text exists
    ✓ loads default state
    ✓ loads component with "Change Password" (submit) button disabled
    ✓ confirms "too short" password when input < 15 chars
    ✓ confirms "strong" password when input > 15 chars
    ✓ enables "Change Password" (submit) button when passwords match
    ✓ displays submit message
    ✓ displays submit failure message

What is going on here?

1999 commented 5 years ago

That's something new. Could you please provide your test file so I can investigate the case? It looks like the "test end" event is not happening which means that your "it" functions don't finish executing.

createthis commented 5 years ago

This appears to be caused by --exit. When I remove --exit the horizontal scrolling stops.

1999 commented 5 years ago

This is also very interesting, I didn't even expect that it can change the events order. Can you still post a small example of your tests with this problem?

createthis commented 5 years ago

alpha.3 solves this problem! Thank you.