From 7e0c259d20844e102fd5aa1f213bfd56dc2a1540 Mon Sep 17 00:00:00 2001 From: Ben Chauvette Date: Sat, 24 Sep 2016 08:09:57 -0400 Subject: [PATCH 1/2] [vinyl] Add test for File.isVinyl --- vinyl/vinyl-tests.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index 1d39646b11..387bc0ce9a 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -121,6 +121,19 @@ describe('File', () => { }); + describe('File.isVinyl()', () => { + it('should return true when an object is a Vinyl file', done => { + var file = new File(); + File.isVinyl(file).should.equal(true); + done(); + }); + + it('should return false when an object is not a Vinyl file', done => { + File.isVinyl({}).should.equal(false); + done(); + }); + }); + describe('isBuffer()', () => { it('should return true when the contents are a Buffer', done => { var val = new Buffer("test"); From 5f34eea83b427afc487968265dc6b5884aac5f33 Mon Sep 17 00:00:00 2001 From: Ben Chauvette Date: Sat, 24 Sep 2016 08:13:22 -0400 Subject: [PATCH 2/2] [vinyl] Add File.isCustomProp See gulpjs/vinyl@7b01e75 --- vinyl/vinyl-tests.ts | 12 ++++++++++++ vinyl/vinyl.d.ts | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index 387bc0ce9a..49de15b54d 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -134,6 +134,18 @@ describe('File', () => { }); }); + describe('File.isCustomProp()', () => { + it('should return true when a File property is not managed internally', done => { + File.isCustomProp('foobar').should.equal(true); + done(); + }); + + it('should return false when a File property is managed internally', done => { + File.isCustomProp('cwd').should.equal(false); + done(); + }); + }); + describe('isBuffer()', () => { it('should return true when the contents are a Buffer', done => { var val = new Buffer("test"); diff --git a/vinyl/vinyl.d.ts b/vinyl/vinyl.d.ts index bcee5c6614..9861cf1b3c 100644 --- a/vinyl/vinyl.d.ts +++ b/vinyl/vinyl.d.ts @@ -1,5 +1,5 @@ -// Type definitions for vinyl 1.1.0 -// Project: https://github.com/wearefractal/vinyl +// Type definitions for vinyl 1.2.0 +// Project: https://github.com/gulpjs/vinyl // Definitions by: vvakame , jedmao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -140,6 +140,11 @@ declare module "vinyl" { * Checks if a given object is a vinyl file. */ public static isVinyl(obj: any): boolean; + + /** + * Checks if a property is not managed internally. + */ + public static isCustomProp(name: string): boolean; } export = File;