Skip to content

Commit

Permalink
implemented windows compatible test-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
schaermu committed Oct 30, 2012
1 parent 488500e commit 8b8932f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 13 deletions.
7 changes: 7 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
set REPORTER="list"

:test
setx NODE_ENV "test"
node_modules\.bin\mocha.cmd -u bdd --require should --reporter "%REPORTER%"
setx NODE_ENV "production"
2 changes: 1 addition & 1 deletion examples/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ var proc = new ffmpeg({ source: infs, nolog: true })
})
.saveToFile('/path/to/your_target.flv', function(stdout, stderr, err) {
console.log('done processing input stream');
});
});
3 changes: 1 addition & 2 deletions lib/debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

exports = module.exports = function Debug(command) {
this.getCommand = function(outputmethod, callback) {
var self = this;
Expand Down Expand Up @@ -43,4 +42,4 @@ exports = module.exports = function Debug(command) {
return this.buildFfmpegArgs(true, null);
}
};
};
};
2 changes: 1 addition & 1 deletion lib/fluent-ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@ exports.Metadata = require('./metadata');
exports.Calculate = require('./calculate');

exports.CONSTANT_BITRATE = 1;
exports.VARIABLE_BITRATE = 2;
exports.VARIABLE_BITRATE = 2;
7 changes: 4 additions & 3 deletions test/args.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Ffmpeg = require('../index'),
path = require('path'),
exec = require('child_process').exec;
exec = require('child_process').exec,
testhelper = require('./helpers');

describe('Command', function() {
before(function(done) {
Expand All @@ -9,8 +10,8 @@ describe('Command', function() {
this.testfilewide = __dirname + '/assets/testvideo-169.avi';

var self = this;
exec('which ffmpeg', function(err, stdout, stderr) {
if (stdout !== '') {
exec(testhelper.getFfmpegCheck(), function(err, stdout, stderr) {
if (!err) {
// check if file exists
path.exists(self.testfile, function(exists) {
if (exists) {
Expand Down
7 changes: 4 additions & 3 deletions test/debug.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Ffmpeg = require('../index'),
path = require('path'),
exec = require('child_process').exec;
exec = require('child_process').exec
testhelper = require('./helpers');

describe('Debug', function() {
before(function(done) {
Expand All @@ -9,8 +10,8 @@ describe('Debug', function() {
this.testfilewide = __dirname + '/assets/testvideo-169.avi';

var self = this;
exec('which ffmpeg', function(err, stdout, stderr) {
if (stdout !== '') {
exec(testhelper.getFfmpegCheck(), function(err, stdout, stderr) {
if (!err) {
// check if file exists
path.exists(self.testfile, function(exists) {
if (exists) {
Expand Down
13 changes: 13 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
exports = module.exports = TestHelpers = {
getFfmpegCheck: function() {
var platform = require('os').platform();

if (!platform.match(/win(32|64)/)) {
// linux/mac, use which
return 'which ffmpeg';
} else {
// windows, use where (> windows server 2003 / windows 7)
return 'where /Q ffmpeg';
}
}
}
7 changes: 4 additions & 3 deletions test/processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var Ffmpeg = require('../index'),
fs = require('fs'),
assert = require('assert'),
os = require('os').platform(),
exec = require('child_process').exec;
exec = require('child_process').exec,
testhelper = require('./helpers');

describe('Processor', function() {
before(function(done) {
Expand All @@ -13,8 +14,8 @@ describe('Processor', function() {
this.testfileEscaped = __dirname + '/assets/te[s]t audio \' " .ogg';

var self = this;
exec('which ffmpeg', function(err, stdout, stderr) {
if (stdout !== '') {
exec(testhelper.getFfmpegCheck(), function(err, stdout, stderr) {
if (!err) {
// check if file exists
path.exists(self.testfile, function(exists) {
if (exists) {
Expand Down

0 comments on commit 8b8932f

Please sign in to comment.