运行Js测试获取错误窗口是未定义的

时间:2017-02-24 23:18:17

标签: javascript karma-jasmine jshint

使用karma + jasmine运行JS测试

我收到错误'窗口'没有定义,我添加了防御性代码来检测浏览器,如此

SELECT
view_monthly_chart.pay_month, view_monthly_chart.transDesc AS Transaction,
CASE WHEN view_monthly_chart.transDesc = 'Bills' THEN debit ELSE 0 END AS bills,
CASE WHEN view_monthly_chart.transDesc = 'Misc' THEN debit ELSE 0 ENDAS misc,
CASE WHEN view_monthly_chart.transDesc = 'Inc' THEN debit ELSE 0 END AS inc,
CASE WHEN view_monthly_chart.transDesc = 'Bank Trans' THEN debit ELSE 0 END AS bank_trans
FROM view_monthly_chart 
GROUP BY view_monthly_chart.pay_month, view_monthly_chart.transDesc
ORDER BY view_monthly_chart.pay_id DESC

但仍然出错,如何定义窗口类型并同时取消定义窗口?

修改

确切的错误是:' window'未定义

1 个答案:

答案 0 :(得分:0)

缺少的是这个

/*jshint browser: true*/