@@ -455,7 +455,13 @@ test("Unknown unary postfix error", () => {
455455
456456 expect ( ( ) =>
457457 transformer . transformPostfixUnaryExpression ( mockExpression as ts . PostfixUnaryExpression ) ,
458- ) . toThrowWithMessage ( TranspileError , "Unsupported unary postfix operator kind: AsteriskToken" ) ;
458+ ) . toThrowExactError (
459+ TSTLErrors . UnsupportedKind (
460+ "unary postfix operator" ,
461+ ts . SyntaxKind . AsteriskToken ,
462+ util . nodeStub ,
463+ ) ,
464+ ) ;
459465} ) ;
460466
461467test ( "Unknown unary postfix error" , ( ) => {
@@ -468,26 +474,34 @@ test("Unknown unary postfix error", () => {
468474
469475 expect ( ( ) =>
470476 transformer . transformPrefixUnaryExpression ( mockExpression as ts . PrefixUnaryExpression ) ,
471- ) . toThrowWithMessage ( TranspileError , "Unsupported unary prefix operator kind: AsteriskToken" ) ;
477+ ) . toThrowExactError (
478+ TSTLErrors . UnsupportedKind (
479+ "unary prefix operator" ,
480+ ts . SyntaxKind . AsteriskToken ,
481+ util . nodeStub ,
482+ ) ,
483+ ) ;
472484} ) ;
473485
474486test ( "Incompatible fromCodePoint expression error" , ( ) => {
475487 const transformer = util . makeTestTransformer ( LuaTarget . LuaJIT ) ;
476488
477489 const identifier = ts . createIdentifier ( "fromCodePoint" ) ;
478- expect ( ( ) => transformer . transformStringExpression ( identifier ) ) . toThrowWithMessage (
479- TranspileError ,
480- "string property fromCodePoint is/are not supported for target Lua jit." ,
490+ expect ( ( ) => transformer . transformStringExpression ( identifier ) ) . toThrowExactError (
491+ TSTLErrors . UnsupportedForTarget (
492+ "string property fromCodePoint" ,
493+ LuaTarget . LuaJIT ,
494+ util . nodeStub ,
495+ ) ,
481496 ) ;
482497} ) ;
483498
484499test ( "Unknown string expression error" , ( ) => {
485500 const transformer = util . makeTestTransformer ( LuaTarget . LuaJIT ) ;
486501
487502 const identifier = ts . createIdentifier ( "abcd" ) ;
488- expect ( ( ) => transformer . transformStringExpression ( identifier ) ) . toThrowWithMessage (
489- TranspileError ,
490- "string property abcd is/are not supported for target Lua jit." ,
503+ expect ( ( ) => transformer . transformStringExpression ( identifier ) ) . toThrowExactError (
504+ TSTLErrors . UnsupportedForTarget ( "string property abcd" , LuaTarget . LuaJIT , util . nodeStub ) ,
491505 ) ;
492506} ) ;
493507
@@ -506,15 +520,15 @@ test("Unsupported array function error", () => {
506520
507521 expect ( ( ) =>
508522 transformer . transformArrayCallExpression ( mockNode as ts . CallExpression ) ,
509- ) . toThrowWithMessage ( TranspileError , "Unsupported property on array: unknownFunction") ;
523+ ) . toThrowExactError ( TSTLErrors . UnsupportedProperty ( " array" , " unknownFunction", util . nodeStub ) ) ;
510524} ) ;
511525
512526test ( "Unsupported math property error" , ( ) => {
513527 const transformer = util . makeTestTransformer ( ) ;
514528
515529 expect ( ( ) =>
516530 transformer . transformMathExpression ( ts . createIdentifier ( "unknownProperty" ) ) ,
517- ) . toThrowWithMessage ( TranspileError , "Unsupported property on math: unknownProperty") ;
531+ ) . toThrowExactError ( TSTLErrors . UnsupportedProperty ( " math" , " unknownProperty", util . nodeStub ) ) ;
518532} ) ;
519533
520534test ( "Unsupported object literal element error" , ( ) => {
@@ -531,5 +545,11 @@ test("Unsupported object literal element error", () => {
531545
532546 expect ( ( ) =>
533547 transformer . transformObjectLiteral ( mockObject as ts . ObjectLiteralExpression ) ,
534- ) . toThrowWithMessage ( TranspileError , "Unsupported object literal element kind: FalseKeyword" ) ;
548+ ) . toThrowExactError (
549+ TSTLErrors . UnsupportedKind (
550+ "object literal element" ,
551+ ts . SyntaxKind . FalseKeyword ,
552+ util . nodeStub ,
553+ ) ,
554+ ) ;
535555} ) ;
0 commit comments