@@ -274,13 +274,14 @@ describe('@actions/core', () => {
274274 const message = 'this is my error message'
275275 core . error ( new Error ( message ) , {
276276 title : 'A title' ,
277+ file : 'root/test.txt' ,
277278 startColumn : 1 ,
278279 endColumn : 2 ,
279280 startLine : 5 ,
280281 endLine : 5
281282 } )
282283 assertWriteCalls ( [
283- `::error title=A title,line=5,endLine=5,col=1,endColumn=2::Error: ${ message } ${ os . EOL } `
284+ `::error title=A title,file=root/test.txt, line=5,endLine=5,col=1,endColumn=2::Error: ${ message } ${ os . EOL } `
284285 ] )
285286 } )
286287
@@ -304,25 +305,59 @@ describe('@actions/core', () => {
304305 const message = 'this is my error message'
305306 core . warning ( new Error ( message ) , {
306307 title : 'A title' ,
308+ file : 'root/test.txt' ,
307309 startColumn : 1 ,
308310 endColumn : 2 ,
309311 startLine : 5 ,
310312 endLine : 5
311313 } )
312314 assertWriteCalls ( [
313- `::warning title=A title,line=5,endLine=5,col=1,endColumn=2::Error: ${ message } ${ os . EOL } `
315+ `::warning title=A title,file=root/test.txt,line=5,endLine=5,col=1,endColumn=2::Error: ${ message } ${ os . EOL } `
316+ ] )
317+ } )
318+
319+ it ( 'notice sets the correct message' , ( ) => {
320+ core . notice ( 'Notice' )
321+ assertWriteCalls ( [ `::notice::Notice${ os . EOL } ` ] )
322+ } )
323+
324+ it ( 'notice escapes the message' , ( ) => {
325+ core . notice ( '\r\nnotice\n' )
326+ assertWriteCalls ( [ `::notice::%0D%0Anotice%0A${ os . EOL } ` ] )
327+ } )
328+
329+ it ( 'notice handles an error object' , ( ) => {
330+ const message = 'this is my error message'
331+ core . notice ( new Error ( message ) )
332+ assertWriteCalls ( [ `::notice::Error: ${ message } ${ os . EOL } ` ] )
333+ } )
334+
335+ it ( 'notice handles parameters correctly' , ( ) => {
336+ const message = 'this is my error message'
337+ core . notice ( new Error ( message ) , {
338+ title : 'A title' ,
339+ file : 'root/test.txt' ,
340+ startColumn : 1 ,
341+ endColumn : 2 ,
342+ startLine : 5 ,
343+ endLine : 5
344+ } )
345+ assertWriteCalls ( [
346+ `::notice title=A title,file=root/test.txt,line=5,endLine=5,col=1,endColumn=2::Error: ${ message } ${ os . EOL } `
314347 ] )
315348 } )
316349
317350 it ( 'annotations map field names correctly' , ( ) => {
318351 const commandProperties = toCommandProperties ( {
319352 title : 'A title' ,
353+ file : 'root/test.txt' ,
320354 startColumn : 1 ,
321355 endColumn : 2 ,
322356 startLine : 5 ,
323357 endLine : 5
324358 } )
325359 expect ( commandProperties . title ) . toBe ( 'A title' )
360+ expect ( commandProperties . file ) . toBe ( 'root/test.txt' )
326361 expect ( commandProperties . col ) . toBe ( 1 )
327362 expect ( commandProperties . endColumn ) . toBe ( 2 )
328363 expect ( commandProperties . line ) . toBe ( 5 )
0 commit comments