88 lines
6.4 KiB
JavaScript
88 lines
6.4 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
const should = require("should");
|
|
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;
|
|
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');
|
|
});
|
|
it('should read a directory of Dockerfiles', function (done) {
|
|
NpmciBuildDocker.readDockerfiles()
|
|
.then(function (readDockerfilesArrayArg) {
|
|
should(readDockerfilesArrayArg[1].version).equal('sometag1');
|
|
sortableArray = readDockerfilesArrayArg;
|
|
done();
|
|
});
|
|
});
|
|
it('should sort an array of Dockerfiles', function (done) {
|
|
NpmciBuildDocker.sortDockerfiles(sortableArray)
|
|
.then(function (sortedArrayArg) {
|
|
console.log(sortedArrayArg);
|
|
done();
|
|
});
|
|
});
|
|
it('should correctly chain Dockerfile handling', function (done) {
|
|
NpmciBuildDocker.build()
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
describe('.publish.docker', function () {
|
|
it('should publish all built Dockerfiles', function (done) {
|
|
NpmciPublish.publish('docker')
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
describe('.test.npm', function () {
|
|
it('should source nvm using bash and install a specific node version, then test it', function (done) {
|
|
NpmciTest.test('legacy')
|
|
.then(() => {
|
|
return NpmciTest.test('lts');
|
|
})
|
|
.then(() => {
|
|
return NpmciTest.test('stable');
|
|
})
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
describe('test.docker', function () {
|
|
it('should test dockerfiles', function (done) {
|
|
NpmciTest.test('docker')
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
describe('npmci prepare ssh', function () {
|
|
it('should pick up SSH keys', function (done) {
|
|
NpmciSsh.ssh()
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsNkJBQTRCO0FBRTVCLHFCQUFxQjtBQUNyQixPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsR0FBRyx1REFBdUQsQ0FBQTtBQUNuRixPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsR0FBRywyQkFBMkIsQ0FBQTtBQUN4RCxPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVUsR0FBRyxNQUFNLENBQUE7QUFDL0IsT0FBTyxDQUFDLEdBQUcsR0FBRztJQUNWLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyxTQUFTLENBQUMsQ0FBQTtBQUN6QyxDQUFDLENBQUE7QUFJRCwrREFBK0Q7QUFDL0Qsc0RBQXNEO0FBQ3RELGdEQUFnRDtBQUNoRCw4Q0FBOEM7QUFHOUMsSUFBSSxXQUF3QyxDQUFBO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