Skip to content

Unexpected throw in .throws() #1439

@StoneCypher

Description

@StoneCypher

You can replicate by pulling my repo and uncommenting the commented-out test.

Test Source

  it('probable exits for throws on non-state', t => t.throws(() => {
    const machine = new jssm.machine({
      initial_state: '1',
      transitions:[
        { name:'id1', from:'1', to:'2', action:'identical' }
      ]
    });
    // why does this test fail Threw unexpected exception: 'No such state "3" in probable_exits_for' >:(
    machine.probable_exits_for('3');
  }, Error));

Error Message & Stack Trace

  general › Illegal machines probable exits for throws on non-state
  /Users/johnhaugeland/projects/jssm/src/js/tests/general.js:780

   779:                                                                     
   780:   it('probable exits for throws on non-state', t => t.throws(() => {
   781:                                                                     

  Threw unexpected exception:

  'No such state "3" in probable_exits_for'

The exception is expected, and that is the correct exception message.

This test is a .throws(). I don't understand why this is treated as a failure. Near-verbatim identical tests cover my other throws and work as expected.

Config

I do not configure Ava. No such block or .rc exists in my project.

Command-Line Arguments

My build is trivial.

    "test": "ava src/js/tests/*.js",

Relevant Links

This is the repo.

Environment

Replicates under MacOS current and Windows 10 Pro current. Both tested under node 8 current.

Replicates on travis-ci under node-6, node-7, and node-8, all current, all under whatever linux they use.

All are using ava 0.20.0, installed as local node modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions