Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verification null value missing #201

Open
hennadiib opened this issue Oct 31, 2018 · 9 comments
Open

Verification null value missing #201

hennadiib opened this issue Oct 31, 2018 · 9 comments

Comments

@hennadiib
Copy link
Contributor

hennadiib commented Oct 31, 2018

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
Copy link
Contributor Author

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

@hennadiib hennadiib reopened this Oct 31, 2018
@1999
Copy link
Collaborator

1999 commented Oct 31, 2018

@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
Copy link
Collaborator

1999 commented Nov 22, 2018

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

@hennadiib
Copy link
Contributor Author

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...

@1999
Copy link
Collaborator

1999 commented Nov 22, 2018

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.

@imurchie
Copy link

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.

@ghost
Copy link

ghost commented Feb 18, 2019

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)

@imurchie
Copy link

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.

@DJ-Glock
Copy link

DJ-Glock commented Oct 8, 2019

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.

hinhengchan pushed a commit to hinhengchan/mocha-parallel-tests that referenced this issue Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants