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/");
|
|
|
|
};
|
|
|
|
//require NPMCI files
|
|
|
|
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-07 02:31:25 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZX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