function shouldThrow(assert, fnAct, expectedError) {
		var done = assert.async();
		var oldOnError = window.onerror;

		function checkAndRestore(msg, qualifier) {
			window.removeEventListener("error", onError);
			window.removeEventListener("unhandledrejection", onUnhandledRejection);
			window.onerror = oldOnError;
			assert.ok(expectedError.test(msg), "message of " + qualifier + " should match the expected message");
			done();
		}

		function onError(e) {
			e.stopImmediatePropagation();
			e.preventDefault();
			checkAndRestore(e.message, "uncaught global error");
		}

		function onUnhandledRejection(e) {
			e.stopImmediatePropagation();
			e.preventDefault();
			checkAndRestore(e.reason && e.reason.message, "unhandled rejection reason");
		}

		window.onerror = null; // deactivate qunit global error handler
		window.addEventListener("error", onError);
		window.addEventListener("unhandledrejection", onUnhandledRejection);

		try {
			fnAct();
		} catch (err) {
			checkAndRestore(err && err.message, "synchronously thrown error");
		}
	}
/*
	 * Helper to check error reporting of the (sap.ui.)require implementation.
	 *
	 * When an error callback is given, the implementation reports errors always via that callback.
	 * If none is given, it might throw synchronously, in a new task or in a micro task.
	 * This helper covers all 3 ways to decouple the tests from the implementation.
	 */
Helper to check error reporting of the (sap.ui.)require implementation.
When an error callback is given, the implementation reports errors always via that callback.
If none is given, it might throw synchronously, in a new task or in a micro task.
This helper covers all 3 ways to decouple the tests from the implementation.
Helper to check error reporting of the ( sap . ui . ) require implementation . When an error callback is given the implementation reports errors always via that callback . If none is given it might throw synchronously in a new task or in a micro task . This helper covers all 3 ways to decouple the tests from the implementation .
function shouldThrow(assert, fnAct, expectedError) {
		var done = assert.async();
		var oldOnError = window.onerror;
		function checkAndRestore(msg, qualifier) {
			window.removeEventListener("error", onError);
			window.removeEventListener("unhandledrejection", onUnhandledRejection);
			window.onerror = oldOnError;
			assert.ok(expectedError.test(msg), "message of " + qualifier + " should match the expected message");
			done();
		}
		function onError(e) {
			e.stopImmediatePropagation();
			e.preventDefault();
			checkAndRestore(e.message, "uncaught global error");
		}
		function onUnhandledRejection(e) {
			e.stopImmediatePropagation();
			e.preventDefault();
			checkAndRestore(e.reason && e.reason.message, "unhandled rejection reason");
		}
		window.onerror = null; 
		window.addEventListener("error", onError);
		window.addEventListener("unhandledrejection", onUnhandledRejection);
		try {
			fnAct();
		} catch (err) {
			checkAndRestore(err && err.message, "synchronously thrown error");
		}
	}
function shouldThrow ( assert , fnAct , expectedError ) { var done = assert . async ( ) ; var oldOnError = window . onerror ; function checkAndRestore ( msg , qualifier ) { window . removeEventListener ( "error" , onError ) ; window . removeEventListener ( "unhandledrejection" , onUnhandledRejection ) ; window . onerror = oldOnError ; assert . ok ( expectedError . test ( msg ) , "message of " + qualifier + " should match the expected message" ) ; done ( ) ; } function onError ( e ) { e . stopImmediatePropagation ( ) ; e . preventDefault ( ) ; checkAndRestore ( e . message , "uncaught global error" ) ; } function onUnhandledRejection ( e ) { e . stopImmediatePropagation ( ) ; e . preventDefault ( ) ; checkAndRestore ( e . reason && e . reason . message , "unhandled rejection reason" ) ; } window . onerror = null ; window . addEventListener ( "error" , onError ) ; window . addEventListener ( "unhandledrejection" , onUnhandledRejection ) ; try { fnAct ( ) ; } catch ( err ) { checkAndRestore ( err && err . message , "synchronously thrown error" ) ; } }
Helper to check error reporting of the (sap.ui.
Helper to check error reporting of the ( sap . ui .
// deactivate qunit global error handler