简体   繁体   中英

execute javascript (node.js) code right from Visual Studio in REPL manner

I want to run some javascript code (unit and interaction tests) right in visual studio and be able to see console output. Is it possible to do that with VS???

用于Visual Studio的Node.js工具有一个可用于此类事物的node.jsREPL

I love the Interactive Window for Visual Studio (and 2017) but lately I have been starting to use Visual Studio Code. I really like it but the Interactive Window (REPL) is missing.

I need that. So I tried several extensions but none of them was as good as Node.js Tools for VS. The solution was to make one my self, you may need NodeJs 8+ to use Node.js REPL for Visual Studio Code.

Preview of Node.js REPL for VS Code

在此输入图像描述

I believe it is possible, at least to a degree. I haven't done exactly what you're saying, but I do have node running in iis with iisnode. I also know that there is a version of iisnode that runs under iis express. I would look into that.

My guess is you would be able to launch a project using the iisnode module, and you could set the default document to the .js file you want to run, but you may only be able to get console output through the browser.

iisnode does give you the ability to debug and see the console output through your browser. For example, if you run the iisnode module for a file test.js at localhost:1234/test.js , you can get a the browser developer tools by going to localhost:1234/test.js/debug . That would give you console output, but I'm not totally certain you would be able to get it directly in VS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM