Issues with accuracy() from forecast package when used on a tslm object

Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos

When I create a tslm object with trend and seasonality, and also with a Box-Cox transformation, the accuracy command is producing erroneous results. Here are some examples:

beer_train = window(beer, end = c(1994,8))
beer_test = window(beer, start = c(1994,9))
beer_model = tslm(beer_train~trend+season, lambda = "auto")
accuracy(forecast(beer_model, h = 12), beer_test)
             ME     RMSE     MAE      MPE     MAPE MASE       ACF1 Theil's U
Training set    NaN      NaN     NaN      NaN      NaN  NaN         NA        NA
Test set     6.6302 11.94554 9.87183 4.004911 6.624934  NaN -0.4211141 0.5520526

However, manual calculations, or cal_MASE of the seer package produces results without issues:

seer::cal_MASE(beer_train,beer_test,forecast(beer_model, h = 12)$mean)

[1] 1.022325

This is a bug that was fixed in v8.16 of the forecast package, now on CRAN.