UNPKG

gulp-bump-version

Version:

gulp-bump-version eases and automates the management of semver version strings in the source code of almost any file type.

1 lines 7.19 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const assert=require("assert"),File=require("vinyl"),bump=require("../../index.js");describe("SanityCheck",function(){describe("#indexOf()",function(){it("should return -1 when the value is not present",function(){assert.equal([1,2,3].indexOf(4),-1)})})}),describe("gulp-bump-version I",function(){describe("in buffer mode",function(){it("Should return 0.1.0 as that is what the regex will match. It checks only that it can match.",function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({version:-1});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),"@version: 0.1.0"),e()})})})}),describe("gulp-bump-version II",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version has its "patch" revision incremented by 1',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"patch"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.1 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version III",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version has its "minor" revision incremented by 1',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"minor"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 0.2.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version IV",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version has its "major" revision incremented by 1',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"major"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 1.0.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version V",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version has its "prerelease" revision incremented by 1',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"prerelease"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0-1 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version VI",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version is set to 2.1.31-1',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({version:"2.1.31-1"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 2.1.31-1 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version VII",function(){describe("in buffer mode",function(){it('Should modify the supplied "file" so that the contained version is set to 0.1.1. It uses a customized key with out a semi-colon, and since it was removed from the fake file - it should match.',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"patch",key:"@version"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version 0.1.1 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})}),describe("gulp-bump-version VIII",function(){describe("in buffer mode",function(){it('Should not modify the supplied "file" leaving the version set to 0.1.0. It uses a customized key where the semi-colon has been removed, yet since it exists in our fake file - it should not match.',function(e){let t=new File({contents:new Buffer('This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!')}),s=bump({type:"patch",key:"@version"});s.write(t),s.once("data",function(t){assert(t.isBuffer()),assert.equal(t.contents.toString("utf8"),'This is just a sample string with a version tag contained in it. Let us say that " @version: 0.1.0 " is what we are matching, and that the test ensures it happens even embedded within this sample text. The test ensures our RegExp is SOLID!'),e()})})})});