簡體   English   中英

我可以重命名 package.json 文件嗎?

[英]Can I rename the package.json file?

我正在使用 Git 存儲庫中的文件通過 Newman 運行 Postman 測試。 這很好用。 我的問題是我有多組測試,每個測試都有自己的 Jenkins 作業,當構建成功時觸發。 我試圖不使用多個 git 存儲庫來托管這些文件。

測試使用 package.json 文件運行,如下所示:

 {
   "name": "postmanfiles",
   "version": "1.0.0",
   "description": "project to store postman collection",
   "main": "index.js",
   "scripts": { "api-tests": "newman run --verbose --timeout 8000000 --reporters 'cli,testrail' 'SearchAPI.postman_collection.json' -e 'My_Environment.postman_environment.json'" },
   "keywords": [ "Postman", "CI" ],
   "author": "Joe Smith",
   "license": "ISC",
   "dependencies": { "newman": "^6.14.10"
 }

對於每組測試,我有多個 Postman collections,例如“SearchAPI.postman_collection.json”、“ModifyAPI.postman_collection.json”等。

In order to not use multiple Git repos for these tests I need multiple package.json files in one repository because I have five different Postman collections to run. 每個 Jenkins 作業都會觸發單獨的構建。 一種簡單的方法是在一個 Git 存儲庫中擁有五個不同的唯一命名的 package.json 文件。

但我可以這樣做嗎?如果可以,怎么做?

或者有沒有更簡單的方法來做到這一點?

據我所知,你不能。 這就是為什么我們使用 Grunt/Gulp 或 Webpack 等工具來完成復雜的構建工作流程的原因。

我通過在 package.json 中指定多個測試,然后在存儲庫中擁有獨特的 Jenkins 腳本來實現這一點,每組測試一個。

   "scripts": {
"api-tests": "newman run --verbose --timeout 8000000 --reporters 'cli' 'SearchAPI.postman_collection.json' -e 'CTV_Environment.postman_environment.json'",
"site-tests": "newman run --verbose --timeout 8000000 --reporters 'cli' 'SiteAPI.postman_collection.json' -e 'CTV_Environment.postman_environment.json'"

},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM