简体   繁体   English

我如何使用相对路径出错?

[英]How do i make errors use relative paths?

All errors that i encounter use an absolute file path and i feel that it bogs down the console:我遇到的所有错误都使用绝对文件路径,我觉得它使控制台陷入困境:

Error: Example Error
at fail (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:276:11)
at assertEquals (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:272:7)
at assertPointEquals (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:262:5)
at assertCreatesHWall (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:258:5)
at testMazeStartingPointCreatesEdgeWall (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:243:5)
at run (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:290:7)
at runTestsFromList (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:285:7)
at runTests (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:223:5)
at file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:373:13

I feel that it would be much easier to see the relevent information if the irrelevent information were excluded.我觉得如果把不相关的信息排除在外,看到相关的信息会容易得多。 Maybe something like this for example:例如,可能是这样的:

Error: Example Error
at fail (file:./maze.js:276:11)
at assertEquals (file:./maze.js:272:7)
at assertPointEquals (file:./maze.js:262:5)
at assertCreatesHWall (file:./maze.js:258:5)
at testMazeStartingPointCreatesEdgeWall (file:./maze.js:243:5)
at run (file:./maze.js:290:7)
at runTestsFromList (file:./maze.js:285:7)
at runTests (file:./maze.js:223:5)
at file:./maze.js:373:13

Is there any way to change that, or is it all closed off?有什么办法可以改变它,还是全部关闭?

There may be a configuration in the console that you are using.您正在使用的控制台中可能有配置。

What I would do is run a local server.我要做的是运行本地服务器。 It is fairly trivial to set up a basic one.设置一个基本的是相当简单的。 Look at NodeJS the home page has an example of how to do this with a few lines of code.看看NodeJS主页有一个例子,说明如何用几行代码来做到这一点。

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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