是否可以从命令行运行JavaScript文件? [英] Is it possible to run JavaScript files from the command line?

查看:94
本文介绍了是否可以从命令行运行JavaScript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个JS文件,所以如果可能的话,我想从外壳程序中调用它们,而不是在控制台窗口中复制并粘贴每个文件。

I have several JS files so instead of copy and paste every one in the console window (Firefox and Chromium), I would want to call them from the shell if it is possible.

每个JS文件都具有测试功能,这些功能可以使用console.log显示它们是否正确。

Every JS file has test functions that show if they are correct using console.log.

推荐答案

如果测试需要访问DOM的地方,总是有 PhantomJS -无头(Webkit)浏览器。

If your tests need access to a DOM there is always PhantomJS - a headless (Webkit) browser.

这篇关于是否可以从命令行运行JavaScript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆