Angular 6:运行ng test时未加载环境

时间:2018-10-04 12:59:16

标签: angular angular6

我试图在我的angular / 6项目上运行ng test,但是它永远找不到正确的环境文件。无论如何,它始终加载environment/environment.ts。我已经更新了angular.json,使其在配置部分中包含以下几行

"test": {
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "fileReplacements": 
    [
        {
            "replace": "src/environments/environment.ts",
            "with": "src/environments/environment.test.ts"
        }
    ]
},

但无济于事。我尝试使用命令运行

ng test --configuration=test

ng test --environment=test

没有运气。有人可以建议吗?

0 个答案:

没有答案