Qunit assert throws not working

I am trying to assert that a few steps in the code (visiting page, providing wrong card-number, password combination and clicking submit)should generate an error from the backend service - I have referred to this already…

and tried the suggestion of using Error Object as the second argument to assert.throws but that doesn’t work for me.

Here’s my Qunit test

test('ERROR_CASE_visiting /signon, provide cardNumber(2342314) and ' +
'password, submit and expect to see invalid cardnumber/password error', 
function (assert) {

 assert.expect(2);
 assert.throws(
function () {
  visit('/signon');
  fillIn('#a8n-signon-card-number input', '2342314');
  fillIn('#a8n-signon-password input', 'password');
  click('#a8n-signon-submit-button button');
},
Error,
"Error Thrown"
 );
});

Is there anything else that i can try to get it to work.

There’s a workaround on the issue in Github located here you might try: assert.throws fails in component integration tests with ember 2.12 · Issue #256 · emberjs/ember-qunit · GitHub

From nickiaconis’ comment:

"Here’s a work-around for QUnit:

import Ember from ‘ember’; import QUnit from ‘qunit’; import { QUnitAdapter } from ‘ember-qunit’;

// Work-around for Asserting error thrown no longer works as of 2.11 · Issue #15013 · emberjs/ember.js · GitHub const originalAssertThrows = QUnit.assert.throws; const rethrowAdapter = QUnitAdapter.extend({ exception(error) { throw error; }, }).create(); QUnit.assert.throws = () => { const originalAdapter = Ember.Test.adapter; Ember.Test.adapter = rethrowAdapter;

originalAssertThrows.apply(this, arguments);

Ember.Test.adapter = originalAdapter; };"