mocha-parallel-tests icon indicating copy to clipboard operation
mocha-parallel-tests copied to clipboard

Verification null value missing

Open hennadiib opened this issue 6 years ago • 9 comments

Not sure what is the root reason for the issue. Possibly file with ignored tests on describe level (investigating now). Need to be fixed. It fail entire run....

Unhandled asynchronous exception: TypeError: Cannot set property 'toString' of null at Array.subprocessParseReviver (/usr/src/app/node_modules/mocha-parallel-tests/dist/main/util.js:18:26) at Array. (/usr/src/app/node_modules/circular-json/build/circular-json.node.js:138:30) at JSON.parse () at Object.parse (/usr/src/app/node_modules/circular-json/build/circular-json.node.js:196:32) at MochaWrapper.addSubprocessSuites (/usr/src/app/node_modules/mocha-parallel-tests/dist/main/mocha.js:99:59) at TaskManager.taskManager.on (/usr/src/app/node_modules/mocha-parallel-tests/dist/main/mocha.js:73:22) at TaskManager.emit (events.js:180:13) at TaskManager.onTaskProcessingFinished (/usr/src/app/node_modules/mocha-parallel-tests/dist/main/task-manager.js:19:18) at TaskManager.emit (events.js:180:13) at TaskManager.startTaskProcessing (/usr/src/app/node_modules/mocha-parallel-tests/dist/main/task-manager.js:44:14)

hennadiib avatar Oct 31 '18 10:10 hennadiib

Yes, the reason was - I had files with x on describe level

hennadiib avatar Oct 31 '18 11:10 hennadiib

@qatechniker well if this is working okay with mocha and fails with mocha-parallel-tests, this can be an issue. Thanks for posting this, I will investigate this case a bit further.

1999 avatar Oct 31 '18 19:10 1999

Hey @qatechniker do you still have this issue when using xdescribes and mocha-parallel-tests?

1999 avatar Nov 22 '18 09:11 1999

Hey, I think it can not disappear if nobody fixed ))) I just removed this situation in my set up.

Need to create PR to this project with test to proof...

hennadiib avatar Nov 22 '18 09:11 hennadiib

That would be great! Right now we have a test for these methods: https://github.com/mocha-parallel/mocha-parallel-tests/tree/master/test/skip-test, so I was almost sure that mocha-parallel-tests supports xdescribe as well.

1999 avatar Nov 22 '18 09:11 1999

I apologize if this is off-base, but I have an error that presents as the same error.

Environment:

  • Node: v8.14.0
  • Npm: 6.4.1
  • mocha-parallel-tests: 2.0.6-alpha.3
  • mocha: 5.2.0

The situation is when a before all block fails for a skipped describe block. When this happens the error comes out as:

$ $(npm bin)/mocha-parallel-tests test/skipped.js

Unhandled asynchronous exception: TypeError: Cannot set property 'toString' of null
    at Array.subprocessParseReviver (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/util.js:18:26)
    at Array.<anonymous> (/Users/isaac/code/experiments/parallel/node_modules/circular-json/build/circular-json.node.js:138:30)
    at JSON.parse (<anonymous>)
    at Object.parse (/Users/isaac/code/experiments/parallel/node_modules/circular-json/build/circular-json.node.js:196:32)
    at MochaWrapper.addSubprocessSuites (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/mocha.js:99:59)
    at TaskManager.taskManager.on (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/mocha.js:73:22)
    at emitOne (events.js:116:13)
    at TaskManager.emit (events.js:211:7)
    at TaskManager.onTaskProcessingFinished (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/task-manager.js:19:18)
    at emitTwo (events.js:126:13)

While mocha reports correctly:

$ $(npm bin)/mocha test/skipped.js

  describe block
    1) "before all" hook

  0 passing (9ms)
  1 failing

  1) describe block
       "before all" hook:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true

      at Context.before (test/skipped.js:5:5)

The minimal example to trigger this error is:

const assert = require('assert');

describe('describe block', function () {
  before(function () {
    assert(false);
  });

  describe.skip('skipped describe block', function () {
    it('should never get here', function () {
      assert(false);
    });
  });
});

I'm not familiar enough with mocha-parallel-tests to discern what might be the root of the problem. It seems that when the before all hook fails, the subprocessParseReviver gets called with the skipped test, which has a fn property that is null. This overwrites the fn on the test, and then fails. If I go into src/main/util.ts and add delete value.fn in the case of a test, the correct result happens:

$  $(npm bin)/mocha-parallel-tests test/skipped.js

    describe block
      1) "before all" hook

  0 passing (249ms)
  1 failing

  1)
       describe block
         "before all" hook:
     AssertionError [ERR_ASSERTION]: false == true
      at Context.<anonymous> (test/skipped.js:5:5)

This could just be covering over the root cause, though.

imurchie avatar Dec 17 '18 21:12 imurchie

any updates on this issue?

Unhandled asynchronous exception: TypeError: Cannot set property 'toString' of null at Array.subprocessParseReviver (/usr/lib/node_modules/mocha-parallel-tests/dist/main/util.js:18:26) at Array. (/usr/lib/node_modules/mocha-parallel-tests/node_modules/circular-json/build/circular-json.node.js:138:30) at JSON.parse () at Object.parse (/usr/lib/node_modules/mocha-parallel-tests/node_modules/circular-json/build/circular-json.node.js:196:32) at MochaWrapper.addSubprocessSuites (/usr/lib/node_modules/mocha-parallel-tests/dist/main/mocha.js:99:59) at TaskManager.taskManager.on (/usr/lib/node_modules/mocha-parallel-tests/dist/main/mocha.js:73:22) at TaskManager.emit (events.js:189:13) at TaskManager.onTaskProcessingFinished (/usr/lib/node_modules/mocha-parallel-tests/dist/main/task-manager.js:19:18) at TaskManager.emit (events.js:189:13) at TaskManager.startTaskProcessing (/usr/lib/node_modules/mocha-parallel-tests/dist/main/task-manager.js:44:14)

ghost avatar Feb 18 '19 08:02 ghost

We just have a little gulp task to fix the issue in our build pipeline. Not the greatest solution, but until something is addressed here, one that works.

imurchie avatar Feb 20 '19 15:02 imurchie

I apologize if this is off-base, but I have an error that presents as the same error.

Environment:

  • Node: v8.14.0
  • Npm: 6.4.1
  • mocha-parallel-tests: 2.0.6-alpha.3
  • mocha: 5.2.0

The situation is when a before all block fails for a skipped describe block. When this happens the error comes out as:

$ $(npm bin)/mocha-parallel-tests test/skipped.js

Unhandled asynchronous exception: TypeError: Cannot set property 'toString' of null
    at Array.subprocessParseReviver (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/util.js:18:26)
    at Array.<anonymous> (/Users/isaac/code/experiments/parallel/node_modules/circular-json/build/circular-json.node.js:138:30)
    at JSON.parse (<anonymous>)
    at Object.parse (/Users/isaac/code/experiments/parallel/node_modules/circular-json/build/circular-json.node.js:196:32)
    at MochaWrapper.addSubprocessSuites (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/mocha.js:99:59)
    at TaskManager.taskManager.on (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/mocha.js:73:22)
    at emitOne (events.js:116:13)
    at TaskManager.emit (events.js:211:7)
    at TaskManager.onTaskProcessingFinished (/Users/isaac/code/experiments/parallel/node_modules/mocha-parallel-tests/dist/main/task-manager.js:19:18)
    at emitTwo (events.js:126:13)

While mocha reports correctly:

$ $(npm bin)/mocha test/skipped.js

  describe block
    1) "before all" hook

  0 passing (9ms)
  1 failing

  1) describe block
       "before all" hook:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true

      at Context.before (test/skipped.js:5:5)

The minimal example to trigger this error is:

const assert = require('assert');

describe('describe block', function () {
  before(function () {
    assert(false);
  });

  describe.skip('skipped describe block', function () {
    it('should never get here', function () {
      assert(false);
    });
  });
});

I'm not familiar enough with mocha-parallel-tests to discern what might be the root of the problem. It seems that when the before all hook fails, the subprocessParseReviver gets called with the skipped test, which has a fn property that is null. This overwrites the fn on the test, and then fails. If I go into src/main/util.ts and add delete value.fn in the case of a test, the correct result happens:

$  $(npm bin)/mocha-parallel-tests test/skipped.js

    describe block
      1) "before all" hook

  0 passing (249ms)
  1 failing

  1)
       describe block
         "before all" hook:
     AssertionError [ERR_ASSERTION]: false == true
      at Context.<anonymous> (test/skipped.js:5:5)

This could just be covering over the root cause, though.

Have exactly the same issue.

DJ-Glock avatar Oct 08 '19 16:10 DJ-Glock