(Postman) newman 输出 unicode 参数 --disable-unicode

(Postman) newman outputs unicode with parameter --disable-unicode

我想为 newman 输出禁用 unicode。我已经阅读了 newman 的文档,它说要使用 --disable-unicode

纽曼版本:3.9.4

--禁用unicode 指定是否强制禁用 unicode 选项。提供后,输出中的所有符号都将替换为它们的纯文本等效项。

命令:

newman run "ACSF_PE.postman_collection.json" --global-var "HEROKU_APP_NAME=myapp" --global-var "HEROKU_API_TOKEN=********" -r cli,junit,text --disable-unicode --reporter-junit-export Test-Results.xml --reporter-text-export Test-Results.txt

首先我有没有--disable-unicode参数的命令,但是我添加了参数并且输出没有改变,完全一样...

输出:

...

2018-05-30T10:32:19.4940350Z [0mnewman[0m
2018-05-30T10:32:19.4940350Z 
2018-05-30T10:32:19.4940350Z [0mAccenture Cloud TPM[0m
2018-05-30T10:32:19.5252847Z 
2018-05-30T10:32:19.5252847Z Ôûí [0mPre-collection Requests[0m
2018-05-30T10:32:19.5252847Z Ôöö [0mRetrieve Credentials[0m
2018-05-30T10:32:20.1443464Z   [90mGET[39m [90mhttps://api.heroku.com/apps/cas-dev-pipe-app/config-vars[39m [90m[200 OK, 2.55KB, 570ms][39m
2018-05-30T10:32:20.1933674Z [32m   [39m [90mStatus code is 200[39m
2018-05-30T10:32:20.1933674Z [32m   [39m [90mRequired Config Vars[39m
2018-05-30T10:32:20.2089943Z [32m   [39m [90mRequired credentials exist[39m
2018-05-30T10:32:20.2402436Z 
2018-05-30T10:32:20.2402436Z Ôöö [0mAuthorize: Login & Get JWT (HS256)[0m
2018-05-30T10:32:20.4485595Z   [90mPOST[39m [90mhttps://cas-dev-pipe-app.herokuapp.com/auth/login[39m [90m[404 Not Found, 431B, 160ms][39m
2018-05-30T10:32:20.4495595Z {"cursor":{"ref":"eeb9be61-2bea-4b89-9045-7218f94bdd80","length":45,"cycles":1,"position":1,"iteration":0,"httpRequestId":"8f6b275f-da45-4965-82cc-1534b21f70dd"},"response":{"id":"5a4def44-9f82-41f3-b192-aafa1f6a8f6c","status":"Not Found","code":404,"header":[{"key":"Server","value":"Cowboy"},{"key":"Connection","value":"keep-alive"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"150"},{"key":"Vary","value":"Accept-Encoding"},{"key":"Date","value":"Wed, 30 May 2018 10:32:20 GMT"},{"key":"Via","value":"1.1 vegur"}],"stream":{"type":"Buffer","data":[60,33,68,79,67,84,89,80,69,32,104,116,109,108,62,10,60,104,116,109,108,32,108,97,110,103,61,34,101,110,34,62,10,60,104,101,97,100,62,10,60,109,101,116,97,32,99,104,97,114,115,101,116,61,34,117,116,102,45,56,34,62,10,60,116,105,116,108,101,62,69,114,114,111,114,60,47,116,105,116,108,101,62,10,60,47,104,101,97,100,62,10,60,98,111,100,121,62,10,60,112,114,101,62,67,97,110,110,111,116,32,80,79,83,84,32,47,97,117,116,104,47,108,111,103,105,110,60,47,112,114,101,62,10,60,47,98,111,100,121,62,10,60,47,104,116,109,108,62,10]},"cookie":[],"responseTime":160,"responseSize":150},"request":{"description":{"content":"","type":"text/plain"},"url":{"protocol":"https","path":["auth","login"],"host":["cas-dev-pipe-app","herokuapp","com"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"User-Agent","value":"PostmanRuntime/7.1.6"},{"key":"Accept","value":"*/*"},{"key":"Host","value":"cas-dev-pipe-app.herokuapp.com"},{"key":"accept-encoding","value":"gzip, deflate"},{"key":"content-length","value":117}],"method":"POST","body":{"mode":"raw","raw":"{\n\t\"username\" : \"ub1igm55lrs849\",\n\t\"password\" : \"p220b577c3cd5908fa061b6469520c391b70e11bf0d56d0096d29e291b4e1681d\"\n}"},"auth":{"type":"noauth","noauth":[]}},"item":{"id":"5027788f-fe2a-4c67-b44d-aad0d95710ac","name":"Authorize: Login & Get JWT (HS256)","request":{"description":{"content":"","type":"text/plain"},"url":{"path":["auth","login"],"host":["{{ACSF_PE_URL}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"{\n\t\"username\" : \"{{DB_username}}\",\n\t\"password\" : \"{{DB_password}}\"\n}"},"auth":{"type":"noauth","noauth":[]}},"response":[],"event":[{"listen":"test","script":{"id":"b1c3e65e-0032-484e-b129-1d82b9cc51a7","type":"text/javascript","exec":["","//Code","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","//Body","pm.test(\"Body has required attributes\", function () {","    pm.response.to.have.jsonBody('token');","    pm.response.to.have.jsonBody('user.role', pm.variables.get('DB_username'));","});","","","//Post scripts","// Save the token to a Postman environment variable","postman.setEnvironmentVariable(\"JWT_POSTGRAPHILE\", pm.response.json().token);","",""]}},{"listen":"prerequest","script":{"id":"f77d57be-6e67-47d9-a1d3-d0f468638bb7","type":"text/javascript","exec":[""],"_lastExecutionId":"1ce3fc83-4fa7-4c7d-94e4-9b15be2423a9"}}]},"cookies":[]}
2018-05-30T10:32:20.4627101Z [31m[1m  1.[22m[39m [31m[1mStatus code is 200[22m[39m
2018-05-30T10:32:20.4627101Z [31m[1m  2.[22m[39m [31m[1mBody has required attributes[22m[39m
2018-05-30T10:32:20.4783328Z [31m[1m  3Ôáä JSONError in test-script[22m[39m
2018-05-30T10:32:20.5095846Z 
2018-05-30T10:32:20.5095846Z Ôöö [0mSTD: Populate Data-Variables[0m
2018-05-30T10:32:22.0723737Z   [90mPOST[39m [90mhttp://localhost:5000/graphql[39m {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5000}
2018-05-30T10:32:22.0723737Z {"cursor":{"ref":"a5fc877c-781e-42fd-823b-955fb1a3964a","length":45,"cycles":1,"position":2,"iteration":0,"httpRequestId":"087f0c67-215d-4de4-92d7-dfcb50f4d2ad"},"request":{"description":{"content":"","type":"text/plain"},"url":{"protocol":"http","port":"5000","path":["graphql"],"host":["localhost"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer {{JWT_POSTGRAPHILE}}","system":true}],"method":"POST","body":{"mode":"raw","raw":"{\r\n\t\"query\": \"{ allProductCs{nodes{externalidC sfid}} allAccountExtensionCs{nodes{externalidC sfid}} allKpiSetCs{nodes{name sfid}} allSalesOrganizationCs{nodes{name sfid}}}\"\r\n}"}},"item":{"id":"8d856d77-3204-4b22-9000-702ecc0ac059","name":"STD: Populate Data-Variables","request":{"description":{"content":"","type":"text/plain"},"url":{"protocol":"http","port":"5000","path":["graphql"],"host":["localhost"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"{\r\n\t\"query\": \"{ allProductCs{nodes{externalidC sfid}} allAccountExtensionCs{nodes{externalidC sfid}} allKpiSetCs{nodes{name sfid}} allSalesOrganizationCs{nodes{name sfid}}}\"\r\n}"}},"response":[],"event":[{"listen":"test","script":{"id":"d5af99b0-e755-41d4-aa9d-f0c8bdfb7beb","type":"text/javascript","exec":["","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","var response = pm.response.json();","","//Body","pm.test(\"Body has required attributes\", function () {","    pm.response.to.have.jsonBody('data.allProductCs.nodes');","    pm.response.to.have.jsonBody('data.allAccountExtensionCs.nodes');","    pm.response.to.have.jsonBody('data.allKpiSetCs.nodes');","    pm.response.to.have.jsonBody('data.allSalesOrganizationCs.nodes');","});","","// product__c","Object.getOwnPropertyNames(pm.environment.toObject()).filter(","    function(d){","        return /product__c./.test(d);","    }).forEach(function(key) {","        pm.environment.unset(key);","    });","","response.data.allProductCs.nodes.forEach(function(node) {","    pm.environment.set('product__c.' + node.externalidC, node.sfid);","});","","","// account_extension__c","Object.getOwnPropertyNames(pm.environment.toObject()).filter(","    function(d){","        return /account_extension__c./.test(d);","    }).forEach(function(key) {","        pm.environment.unset(key);","    });","response.data.allAccountExtensionCs.nodes.forEach(function(node) {","    pm.environment.set('account_extension__c.' + node.externalidC, node.sfid);","});","","// kpi_set__c","Object.getOwnPropertyNames(pm.environment.toObject()).filter(","    function(d){","        return /kpi_set__c./.test(d);","    }).forEach(function(key) {","        pm.environment.unset(key);","    });","response.data.allKpiSetCs.nodes.forEach(function(node) {","    pm.environment.set('kpi_set__c.' + node.externalidC, node.sfid);","});","","// sales_organization__c","Object.getOwnPropertyNames(pm.environment.toObject()).filter(","    function(d){","        return /sales_organization__c./.test(d);","    }).forEach(function(key) {","        pm.environment.unset(key);","    });","response.data.allSalesOrganizationCs.nodes.forEach(function(node) {","    pm.environment.set('sales_organization__c.' + node.externalidC, node.sfid);","});","","postman.setNextRequest(null);"]}}]}}
2018-05-30T10:32:22.0879992Z [31m[1m  5.[22m[39m [31m[1mStatus code is 200[22m[39m
2018-05-30T10:32:22.0879992Z [31m[1m  6Ôáä JSONError in test-script[22m[39m

...

注意:当我保存这个时,输出的 unicode 字符没有显示 post

解法: 添加参数 --no-color

设置 --color off 对我有效。