2016-06-05 11:01:45 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
|
|
|
require("should");
|
|
|
|
var path = require("path");
|
2016-06-05 11:50:45 +00:00
|
|
|
var beautylog = require("beautylog");
|
2016-06-05 11:01:45 +00:00
|
|
|
//set up environment
|
|
|
|
process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git";
|
2016-06-05 12:55:08 +00:00
|
|
|
process.env.NPMTS_TEST = "true";
|
2016-06-05 11:01:45 +00:00
|
|
|
process.cwd = function () {
|
|
|
|
return path.join(__dirname, "assets/");
|
|
|
|
};
|
|
|
|
var NpmciBuildDocker = require("../dist/npmci.build.docker");
|
2016-06-05 15:17:15 +00:00
|
|
|
var NpmciPublish = require("../dist/npmci.publish");
|
2016-06-05 14:56:07 +00:00
|
|
|
var NpmciTest = require("../dist/npmci.test");
|
2016-06-05 11:01:45 +00:00
|
|
|
var dockerfile1;
|
|
|
|
var dockerfile2;
|
|
|
|
var sortableArray;
|
|
|
|
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) {
|
|
|
|
readDockerfilesArrayArg[1].version.should.equal("sometag1");
|
|
|
|
sortableArray = readDockerfilesArrayArg;
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it("should sort an array of Dockerfiles", function (done) {
|
|
|
|
NpmciBuildDocker.sortDockerfiles(sortableArray)
|
|
|
|
.then(function (sortedArrayArg) {
|
2016-06-05 11:50:45 +00:00
|
|
|
beautylog.success("final result");
|
2016-06-05 11:01:45 +00:00
|
|
|
console.log(sortedArrayArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 12:55:08 +00:00
|
|
|
it("should correctly chain Dockerfile handling", function (done) {
|
|
|
|
NpmciBuildDocker.build()
|
|
|
|
.then(function () {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 11:01:45 +00:00
|
|
|
});
|
2016-06-05 15:17:15 +00:00
|
|
|
describe(".publish.docker", function () {
|
|
|
|
it("should publish all built Dockerfiles", function (done) {
|
|
|
|
NpmciPublish.publish("docker")
|
|
|
|
.then(function () {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
;
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 14:56:07 +00:00
|
|
|
describe(".test.npm", function () {
|
2016-06-07 02:31:25 +00:00
|
|
|
it("should source nvm using bash and install a specific node version, then test it", function (done) {
|
2016-06-05 14:56:07 +00:00
|
|
|
NpmciTest.test("legacy")
|
|
|
|
.then(function () {
|
|
|
|
return NpmciTest.test("lts");
|
|
|
|
})
|
|
|
|
.then(function () {
|
|
|
|
return NpmciTest.test("stable");
|
|
|
|
})
|
|
|
|
.then(function () {
|
2016-06-07 02:31:25 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe("test.docker", function () {
|
|
|
|
it("should test dockerfiles", function (done) {
|
|
|
|
NpmciTest.test("docker")
|
2016-06-05 14:56:07 +00:00
|
|
|
.then(function () {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 11:01:45 +00:00
|
|
|
});
|
|
|
|
|
2016-06-09 01:42:12 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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