Automated tests 如何从外部文件夹运行测试?

Automated tests 如何从外部文件夹运行测试?,automated-tests,nightwatch.js,Automated Tests,Nightwatch.js,我有这样一个目录: home -node_modules --nightwatch -nwTests --example.js 我尝试使用以下命令将example.js作为夜间监视测试运行: nightwatch -t ./../../nwTests/example.js 但它给了我一个错误: Cannot find module '/home/node_modules/nightwatch/home/nwTests/example. 当它在nightwatch文件

我有这样一个目录:

home
  -node_modules
    --nightwatch
  -nwTests
    --example.js
我尝试使用以下命令将example.js作为夜间监视测试运行:

nightwatch -t ./../../nwTests/example.js
但它给了我一个错误:

Cannot find module '/home/node_modules/nightwatch/home/nwTests/example.

当它在nightwatch文件夹中时,它工作得非常完美,但我必须把测试放在外面。那么,如何从外部运行测试?谢谢你的帮助

我不确定你在哪个操作系统上

在mac或linux上,在运行文件之前,编写一个bash脚本以更改到正确的目录

当脚本结束时,您仍将在开始的目录中

创建文件并添加:

#!/bin/bash

cd /full/path/to/nightwatch/folder

nightwatch -t example.js
然后运行chmoda+x filename以使文件可执行


使用./filename运行它

我不确定你在哪个操作系统上

在mac或linux上,在运行文件之前,编写一个bash脚本以更改到正确的目录

当脚本结束时,您仍将在开始的目录中

创建文件并添加:

#!/bin/bash

cd /full/path/to/nightwatch/folder

nightwatch -t example.js
然后运行chmoda+x filename以使文件可执行

使用./filename运行它