2016-06-05 11:01:45 +00:00
|
|
|
"use strict";
|
2017-03-11 00:10:37 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2016-06-05 11:01:45 +00:00
|
|
|
require("typings-test");
|
2016-11-14 23:07:55 +00:00
|
|
|
const should = require("should");
|
2016-11-25 12:25:45 +00:00
|
|
|
const path = require("path");
|
|
|
|
// set up environment
|
|
|
|
process.env.CI_BUILD_REPO = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git';
|
|
|
|
process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##';
|
|
|
|
process.env.NPMTS_TEST = 'true';
|
|
|
|
process.cwd = () => {
|
|
|
|
return path.join(__dirname, 'assets/');
|
|
|
|
};
|
|
|
|
const NpmciBuildDocker = require("../dist/npmci.build.docker");
|
|
|
|
const NpmciPublish = require("../dist/npmci.publish");
|
|
|
|
const NpmciTest = require("../dist/npmci.test");
|
|
|
|
const NpmciSsh = require("../dist/npmci.ssh");
|
|
|
|
let dockerfile1;
|
|
|
|
let dockerfile2;
|
|
|
|
let sortableArray;
|
2016-11-14 23:07:55 +00:00
|
|
|
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 });
|
|
|
|
should(dockerfile1.version).equal('latest');
|
|
|
|
should(dockerfile2.version).equal('sometag1');
|
2016-06-05 11:01:45 +00:00
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
it('should read a directory of Dockerfiles', function (done) {
|
2016-06-05 11:01:45 +00:00
|
|
|
NpmciBuildDocker.readDockerfiles()
|
|
|
|
.then(function (readDockerfilesArrayArg) {
|
2016-11-14 23:07:55 +00:00
|
|
|
should(readDockerfilesArrayArg[1].version).equal('sometag1');
|
2016-06-05 11:01:45 +00:00
|
|
|
sortableArray = readDockerfilesArrayArg;
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
it('should sort an array of Dockerfiles', function (done) {
|
2016-06-05 11:01:45 +00:00
|
|
|
NpmciBuildDocker.sortDockerfiles(sortableArray)
|
|
|
|
.then(function (sortedArrayArg) {
|
|
|
|
console.log(sortedArrayArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
it('should correctly chain Dockerfile handling', function (done) {
|
2016-06-05 12:55:08 +00:00
|
|
|
NpmciBuildDocker.build()
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-06-05 12:55:08 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 11:01:45 +00:00
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
describe('.publish.docker', function () {
|
|
|
|
it('should publish all built Dockerfiles', function (done) {
|
|
|
|
NpmciPublish.publish('docker')
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-06-05 15:17:15 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
describe('.test.npm', function () {
|
|
|
|
it('should source nvm using bash and install a specific node version, then test it', function (done) {
|
|
|
|
NpmciTest.test('legacy')
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-11-14 23:07:55 +00:00
|
|
|
return NpmciTest.test('lts');
|
2016-06-05 14:56:07 +00:00
|
|
|
})
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-11-14 23:07:55 +00:00
|
|
|
return NpmciTest.test('stable');
|
2016-06-05 14:56:07 +00:00
|
|
|
})
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-06-07 02:31:25 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
describe('test.docker', function () {
|
|
|
|
it('should test dockerfiles', function (done) {
|
|
|
|
NpmciTest.test('docker')
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-06-05 14:56:07 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-11-14 23:07:55 +00:00
|
|
|
describe('npmci prepare ssh', function () {
|
|
|
|
it('should pick up SSH keys', function (done) {
|
2016-06-26 00:17:17 +00:00
|
|
|
NpmciSsh.ssh()
|
2016-07-18 14:56:53 +00:00
|
|
|
.then(() => {
|
2016-06-26 00:17:17 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-06-05 11:01:45 +00:00
|
|
|
});
|
2017-03-11 00:10:37 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3QkFBcUI7QUFDckIsaUNBQWdDO0FBQ2hDLDZCQUE0QjtBQUU1QixxQkFBcUI7QUFDckIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEdBQUcsdURBQXVELENBQUE7QUFDbkYsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEdBQUcsMkJBQTJCLENBQUE7QUFDeEQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxDQUFBO0FBQy9CLE9BQU8sQ0FBQyxHQUFHLEdBQUc7SUFDVixNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsU0FBUyxDQUFDLENBQUE7QUFDekMsQ0FBQyxDQUFBO0FBSUQsK0RBQStEO0FBQy9ELHNEQUFzRDtBQUN0RCxnREFBZ0Q7QUFDaEQsOENBQThDO0FBR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