| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | import "typings-test"; | 
					
						
							|  |  |  | import "should"; | 
					
						
							|  |  |  | import path = require("path"); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:50:45 +02:00
										 |  |  | import * as beautylog from "beautylog" | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | //set up environment
 | 
					
						
							|  |  |  | process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git"; | 
					
						
							| 
									
										
										
										
											2016-06-05 14:55:08 +02:00
										 |  |  | process.env.NPMTS_TEST = "true"; | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | process.cwd = () => { | 
					
						
							|  |  |  |     return path.join(__dirname,"assets/"); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //require NPMCI files
 | 
					
						
							| 
									
										
										
										
											2016-06-09 03:42:12 +02:00
										 |  |  | import npmci = require("../dist/index"); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | import NpmciBuildDocker = require("../dist/npmci.build.docker"); | 
					
						
							| 
									
										
										
										
											2016-06-05 17:17:15 +02:00
										 |  |  | import NpmciPublish = require("../dist/npmci.publish"); | 
					
						
							| 
									
										
										
										
											2016-06-05 16:56:07 +02:00
										 |  |  | import NpmciTest = require("../dist/npmci.test"); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let dockerfile1:NpmciBuildDocker.Dockerfile; | 
					
						
							|  |  |  | let dockerfile2:NpmciBuildDocker.Dockerfile; | 
					
						
							|  |  |  | let sortableArray:NpmciBuildDocker.Dockerfile[]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe("NPMCI",function(){ | 
					
						
							|  |  |  |     describe("build.docker",function(){ | 
					
						
							|  |  |  |         it("should return valid Dockerfiles",function(){ | 
					
						
							|  |  |  |             dockerfile1 = new NpmciBuildDocker.Dockerfile({filePath:"./Dockerfile",read:true}); | 
					
						
							|  |  |  |             dockerfile2 = new NpmciBuildDocker.Dockerfile({filePath:"./Dockerfile_sometag1",read:true}); | 
					
						
							|  |  |  |             dockerfile1.version.should.equal("latest"); | 
					
						
							|  |  |  |             dockerfile2.version.should.equal("sometag1"); | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |         it("should read a directory of Dockerfiles",function(done){ | 
					
						
							|  |  |  |             NpmciBuildDocker.readDockerfiles() | 
					
						
							|  |  |  |                 .then(function(readDockerfilesArrayArg:NpmciBuildDocker.Dockerfile[]){ | 
					
						
							|  |  |  |                     readDockerfilesArrayArg[1].version.should.equal("sometag1"); | 
					
						
							|  |  |  |                     sortableArray = readDockerfilesArrayArg | 
					
						
							|  |  |  |                     done(); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         it("should sort an array of Dockerfiles",function(done){ | 
					
						
							|  |  |  |             NpmciBuildDocker.sortDockerfiles(sortableArray) | 
					
						
							|  |  |  |                 .then(function(sortedArrayArg:NpmciBuildDocker.Dockerfile[]){ | 
					
						
							| 
									
										
										
										
											2016-06-05 13:50:45 +02:00
										 |  |  |                     beautylog.success("final result"); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  |                     console.log(sortedArrayArg); | 
					
						
							|  |  |  |                     done(); | 
					
						
							|  |  |  |                 }) | 
					
						
							| 
									
										
										
										
											2016-06-05 14:55:08 +02:00
										 |  |  |         }); | 
					
						
							|  |  |  |         it("should correctly chain Dockerfile handling",function(done){ | 
					
						
							|  |  |  |             NpmciBuildDocker.build() | 
					
						
							|  |  |  |                 .then(()=>{ | 
					
						
							|  |  |  |                     done(); | 
					
						
							|  |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  |         }) | 
					
						
							| 
									
										
										
										
											2016-06-05 16:56:07 +02:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-06-05 17:17:15 +02:00
										 |  |  |     describe(".publish.docker",function(){ | 
					
						
							|  |  |  |         it("should publish all built Dockerfiles",function(done){ | 
					
						
							|  |  |  |             NpmciPublish.publish("docker") | 
					
						
							|  |  |  |                 .then(() => { | 
					
						
							|  |  |  |                     done(); | 
					
						
							|  |  |  |                 });; | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-06-05 16:56:07 +02:00
										 |  |  |     describe(".test.npm",function(){ | 
					
						
							| 
									
										
										
										
											2016-06-07 04:31:25 +02:00
										 |  |  |         it("should source nvm using bash and install a specific node version, then test it",function(done){ | 
					
						
							| 
									
										
										
										
											2016-06-05 16:56:07 +02:00
										 |  |  |             NpmciTest.test("legacy") | 
					
						
							|  |  |  |                 .then(() => { | 
					
						
							|  |  |  |                     return NpmciTest.test("lts"); | 
					
						
							|  |  |  |                 }) | 
					
						
							|  |  |  |                 .then(() => { | 
					
						
							|  |  |  |                     return NpmciTest.test("stable"); | 
					
						
							|  |  |  |                 }) | 
					
						
							|  |  |  |                 .then(() => { | 
					
						
							| 
									
										
										
										
											2016-06-07 04:31:25 +02:00
										 |  |  |                     done(); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     describe("test.docker",function(){ | 
					
						
							|  |  |  |         it("should test dockerfiles",function(done){ | 
					
						
							|  |  |  |             NpmciTest.test("docker") | 
					
						
							| 
									
										
										
										
											2016-06-05 16:56:07 +02:00
										 |  |  |                 .then(() => { | 
					
						
							|  |  |  |                     done(); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-06-05 13:01:45 +02:00
										 |  |  | }) |