2

[求助]请教一个问题, travis 上跑测试的时候报错: spawn EACCES

 2 years ago
source link: https://www.v2ex.com/t/803624
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Node.js

[求助]请教一个问题, travis 上跑测试的时候报错: spawn EACCES

  jzlivioo · 19 小时 28 分钟前 · 155 次点击

学习 node 中,写了个跑本地 html 的工具,类似于 live-server

然后在 travis 上跑测试的时候报错了

这两个测试用例是用来验证命令行功能的,使用起来大概是server --version这样子

给这个工具的命令行参数加测试的时候,是读取编译后的 js 文件,然后用 child_process.execFile 来跑这个文件并添加参数,代码如下

...
var cmd = path.join(__dirname, "../lib", "serve.js");
var exec = require("child_process").execFile;
...

function exec_test(args, callback) {
  if (process.platform === "win32")
    exec(process.execPath, [cmd].concat(args), opts, callback);
  else exec(cmd, args, opts, callback);
}

describe("command line usage", function () {
  it("--version", function (done) {
    exec_test(["--version"], function (error, stdout, stdin) {
      assert(!error, error);
      assert(stdout.indexOf("server") !== -1, "version not found");
      done();
    });
  });
  ...

本地跑测试的话是会通过的

请问这是文件访问权限的问题吗?如何解决呢?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK