问题描述
我有一个Javascript项目,我在 cloud9 IDE在线中工作,
,我想使用 testem npm模块来测试我的代码:
npmjs.org/package/testem以及Mocha或Jasmine之类的库。
I have a Javascript project that I work on in cloud9 IDE online,and I wanted to test my code using testem npm module:npmjs.org/package/testem together with libraries like Mocha or Jasmine.
我正在关注
I已经安装了 testem npm模块 ,但是当我在cloud9的终端窗口中使用命令 testem 运行它时,testem要求我打开一个新标签页在 localhost:7357 中
I have installed the testem npm module, but when I run it using command "testem" in cloud9's terminal window testem asks me to open a new tab in "localhost:7357"
通常要预览cloud9中的工作区文件,我将转到
Generally to preview workspace files in cloud9 I would go tohttps://c9.io/username/folders.../workspace/folders.../index.html
由于我在cloud9服务器上,因此我希望
知道它是否可能e从浏览器
打开此 localhost 链接,如果是,我该怎么做?
Since I am on the cloud9 server, I wantedto know if it is possible to open this 'localhost' link from the browser,and if yes, how would I do it?
(我尝试了' localhost ',' 127.0.0.1 ',' 0.0.0.0 在cloud9的IDE中 ,但是它不起作用)。
(I tried 'localhost', '127.0.0.1', '0.0.0.0' inside cloud9's IDE, but it did not work).
也许我可以用其他方式访问它?
Maybe I can access it differently?
就像 username.cl9.io/workspace:PORT一样?
Like "username.cl9.io/workspace:PORT" ?
如果没有,也许有可能提供一个到testem
的链接和端口(以及任何可能的方式?)。我知道cloud9中的
您可以使用 process.env.IP 和 process.env.PORT 来提供不同的
模块,但是对
If not, maybe it is possible to provide a link and port to testem(and by any chance how would one do it ?).I know in cloud9 you can use process.env.IP and process.env.PORT to provide to differentmodules, but no idea on how to open such files later from the browser.
任何帮助将不胜感激。
推荐答案
如果使用主机和端口变量运行testem:
If you run testem with the host and port variables:
testem --host $IP -p $PORT
您应该能够通过以下方式从浏览器连接到外部服务器的根目录:
You should be able to connect from your browser by going to the root of your external server:
http://workspace.username.c9users.io/
这篇关于如何连接到cloud9服务器内部的'localhost'上运行的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!