-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include traceur runtime into transpiled distribution file + test
- Loading branch information
Showing
6 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var mocha = require('gulp-mocha'); | ||
|
||
var exec = require('child_process').exec; | ||
|
||
//This task build in separate process to ensure that | ||
//Traceur runtime is undefined for upcoming ES5 test | ||
gulp.task('build', function (cb) { | ||
exec('gulp build', function (err, stdout, stderr) { | ||
console.log(stdout); | ||
console.log(stderr); | ||
cb(err); | ||
}); | ||
}); | ||
|
||
gulp.task('default', ['build'], function(){ | ||
return gulp.src('test/es5Spec.js') | ||
.pipe(mocha({ | ||
reporter: 'spec' | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
// jshint -W098 | ||
var should = require('should'); | ||
var fs = require('fs'); | ||
|
||
var Jasstor = require('../dist/jasstor'); | ||
var checkError = require('./testUtils').checkError; | ||
|
||
var credentialsFile = 'testCredentials.txt'; | ||
|
||
describe('Transpiled Jasstor library', function () { | ||
var jasstor = new Jasstor(credentialsFile); | ||
beforeEach(function (done) { | ||
//ignore error when testing file didn't exist before deletion | ||
fs.unlink(credentialsFile, function (err) { | ||
jasstor.saveCredentials('user', 'password', function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
it('should work when included into ES5 module', function(done) { | ||
fs.readFile(credentialsFile, function (err, data) { | ||
checkError(err, done); | ||
var jsonData = JSON.parse(data); | ||
jsonData.user.should.be.ok; | ||
jsonData.user.should.not.equal('password'); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports.checkError = function(err, done) { | ||
if (err) { | ||
done(err); | ||
} | ||
}; |