Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expect( () => parser.parse( text ) )
.to.throw( "Unbalanced brace." )
Assertion.addMethod( "parseAs", function ( expected, options ) {
options = typeof options === "undefined" ? {} : options;
const result = parser.parse( utils.flag( this, "object" ), options );
stripProperties( result );
this.assert(
utils.eql( result, expected ),
"expected #{this} to parse as #{exp} but got #{act}",
"expected #{this} to not parse as #{exp}",
expected,
result,
! utils.flag( this, "negate" ),
);
} );
Assertion.addMethod( "failToParse", function ( props ) {
let passed, result;
try {
result = parser.parse( utils.flag( this, "object" ) );
passed = true;
} catch ( e ) {
result = e;
passed = false;
}
if ( passed ) {
stripProperties( result );
}
this.assert(