add proper mocha tests and update deps
This commit is contained in:
@ -1,30 +0,0 @@
|
||||
// import gulp
|
||||
var gulp = require("gulp")
|
||||
var gulpTypescript = require("gulp-typescript");
|
||||
var pr = require("pushrocks");
|
||||
|
||||
gulp.task('compileTS', function() {
|
||||
var stream = gulp.src('../index.ts')
|
||||
.pipe(gulpTypescript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(gulp.dest("../../"));
|
||||
return stream;
|
||||
});
|
||||
|
||||
gulp.task('compileTestTS', function() {
|
||||
var stream = gulp.src('../test.ts')
|
||||
.pipe(gulpTypescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(gulp.dest("../../"));
|
||||
return stream;
|
||||
});
|
||||
|
||||
gulp.task('default',['compileTS','compileTestTS'], function() {
|
||||
pr.beautylog.success('Typescript compiled');
|
||||
});
|
||||
|
||||
//lets tell gulp to start with the default task.
|
||||
pr.beautylog.log('Starting Gulp to compile TypeScript');
|
||||
gulp.start.apply(gulp, ['default']);
|
@ -1,2 +0,0 @@
|
||||
# How to compile.
|
||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./smartfile.plugins.ts" />
|
||||
/// <reference path="./smartfile.simple.ts" />
|
||||
/// <reference path="./smartfile.vinyl.ts" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
module SmartfilePlugins {
|
||||
export var init = function() {
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")("os"),
|
||||
beautylog: require("beautylog"),
|
||||
fs: require("fs-extra"),
|
||||
path: require("path"),
|
||||
vinyl: require("vinyl"),
|
||||
|
45
ts/test.ts
45
ts/test.ts
@ -1,9 +1,36 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var smartfile = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info(smartfile.readFileToString("./test/mytest.txt"));
|
||||
console.log(smartfile.readFileToObject("./test/mytest.yaml"));
|
||||
console.log(smartfile.readFileToObject("./test/mytest.json"));
|
||||
console.log(smartfile.readFileToVinyl("./test/mytest.json"));
|
||||
//var thisIsAnError = smartfile.readFileToObject("./test/mytestDoesNotExist.json");
|
||||
beautylog.success("Test passed!");
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
var smartfile = require("../index.js");
|
||||
var beautylog = require("beautylog");
|
||||
var should = require("should");
|
||||
var vinyl = require("vinyl");
|
||||
describe("smartfile",function(){
|
||||
describe(".readFileToString".yellow,function(){
|
||||
it("should read a file to a string",function(){
|
||||
should.equal(
|
||||
smartfile.readFileToString("./test/mytest.txt"),
|
||||
"Some TestString &&%$"
|
||||
);
|
||||
});
|
||||
});
|
||||
describe(".readFileToObject".yellow,function(){
|
||||
it("should read an " + ".yaml".blue + " file to an object",function(){
|
||||
var testData = smartfile.readFileToObject("./test/mytest.yaml");
|
||||
testData.should.have.property("key1","this works");
|
||||
testData.should.have.property("key2","this works too");
|
||||
|
||||
});
|
||||
it("should read an " + ".json".blue + " file to an object",function(){
|
||||
var testData = smartfile.readFileToObject("./test/mytest.json");
|
||||
testData.should.have.property("key1","this works");
|
||||
testData.should.have.property("key2","this works too");
|
||||
|
||||
});
|
||||
});
|
||||
describe(".readFileToVinyl".yellow,function(){
|
||||
it("should read an " + ".json OR .yaml".blue + " file to an " + "vinyl file object".cyan,function(){
|
||||
var testData = smartfile.readFileToVinyl("./test/mytest.json");
|
||||
(vinyl.isVinyl(testData)).should.be.true();
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
12
ts/tsd.json
12
ts/tsd.json
@ -1,12 +0,0 @@
|
||||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"node/node.d.ts": {
|
||||
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
||||
}
|
||||
}
|
||||
}
|
7
ts/typings.json
Normal file
7
ts/typings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts"
|
||||
}
|
||||
}
|
2079
ts/typings/node/node.d.ts
vendored
2079
ts/typings/node/node.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1
ts/typings/tsd.d.ts
vendored
1
ts/typings/tsd.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
Reference in New Issue
Block a user