无法在Docker容器中运行JavaScript测试

时间:2018-08-26 11:14:35

标签: javascript docker npm nvm

我尝试了一些安装了google-chrome的可用docker容器。尝试以无头模式运行它。尝试过的图像很少:

  • 硒/独立铬

  • zenika / alpine-chrome

已安装nvm和所有必需的软件包

  

运行命令以开始测试或构建时,它只会卡住   永远。

npm test

npm run build

这是testee.json中的配置

{
    "port": 3621,
    "root": ".",
    "reporter": "Spec",
    "timeout": 120,
    "delay": 1000,
    "tunnel": {
        "type": "local"
    },
    "launch": {
        "type": "local"
    },
    "browsers": [{
        "browser": "chrome",
        "args": [
            "--headless",
            "--disable-gpu",
            "--remote-debugging-port=9222"
        ]
    }]
}

1 个答案:

答案 0 :(得分:4)

您需要在浏览器中添加'--no-sandbox'-> testee.json中的args对象

public void Read() {
    String[] delimeter = { " ", "\\.", ",", "\\z"}
    for (String delimeter : delimeter)
    {
        Scanner scanner = new Scanner(args[0]);
            for (int i = 0; i < 8; i++) {
                for (int j = 0; j < 8; j++) {
                String a = s.next();
                board[i][j] = a;
            }
        }   
        scanner.useDelimiter(delimeter);
        String t = scanner.next();

    }

有关更多信息,Click here