Skip to content

Commit

Permalink
Merge 9bf91d9 into 278ad75
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 25, 2015
2 parents 278ad75 + 9bf91d9 commit f5a8748
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 137 deletions.
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ var exports = {
cli.options = {};

cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
cli.setApp(path.join(__dirname, "/../package.json"));

var options = cli.parse(OPTIONS);
// Use config file if specified
Expand Down
46 changes: 23 additions & 23 deletions tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ exports.group = {
},

testOverrides: function (test) {
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
var rep = require("../examples/reporter.js");
var config = {
"asi": true,
Expand Down Expand Up @@ -204,7 +204,7 @@ exports.group = {
},

testOverridesMatchesRelativePaths: function (test) {
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
var rep = require("../examples/reporter.js");
var config = {
"asi": true,
Expand Down Expand Up @@ -244,7 +244,7 @@ exports.group = {
var rep = require("../examples/reporter.js");
var run = this.sinon.stub(cli, "run");
var out = this.sinon.stub(_cli, "error");
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

cli.exit.throws("ProcessExit");
Expand Down Expand Up @@ -350,8 +350,8 @@ exports.group = {

testMalformedNpmFile: function (test) {
this.sinon.stub(process, "cwd").returns(__dirname);
var localNpm = path.normalize(__dirname + "/package.json");
var localRc = path.normalize(__dirname + "/.jshintrc");
var localNpm = path.join(__dirname, "/package.json");
var localRc = path.join(__dirname, "/.jshintrc");
var testStub = this.sinon.stub(shjs, "test");
var catStub = this.sinon.stub(shjs, "cat");

Expand All @@ -377,7 +377,7 @@ exports.group = {

testRcFile: function (test) {
this.sinon.stub(process, "cwd").returns(__dirname);
var localRc = path.normalize(__dirname + "/.jshintrc");
var localRc = path.join(__dirname, "/.jshintrc");
var testStub = this.sinon.stub(shjs, "test");
var catStub = this.sinon.stub(shjs, "cat");

Expand Down Expand Up @@ -419,7 +419,7 @@ exports.group = {
},

testOneLevelRcLookup: function (test) {
var srcDir = __dirname + "../src/";
var srcDir = path.join(__dirname, "../src/");
var parentRc = path.join(srcDir, ".jshintrc");

var cliDir = path.join(srcDir, "cli/");
Expand Down Expand Up @@ -447,8 +447,8 @@ exports.group = {
testTargetRelativeRcLookup: function (test) {
// working from outside the project
this.sinon.stub(process, "cwd").returns(process.env.HOME || process.env.HOMEPATH);
var projectRc = path.normalize(__dirname + "/.jshintrc");
var srcFile = __dirname + "/sub/file.js";
var projectRc = path.join(__dirname, "/.jshintrc");
var srcFile = path.join(__dirname, "/sub/file.js");
var testStub = this.sinon.stub(shjs, "test");
var catStub = this.sinon.stub(shjs, "cat");

Expand All @@ -470,7 +470,7 @@ exports.group = {

testIgnores: function (test) {
var run = this.sinon.stub(cli, "run");
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

cli.interpret([
Expand All @@ -482,7 +482,7 @@ exports.group = {
test.equal(run.args[0][0].ignores[2], path.resolve(dir, "another.js"));

run.restore();
process.cwd.returns(__dirname + "/../");
process.cwd.returns(path.join(__dirname, "/../"));

this.sinon.stub(shjs, "cat")
.withArgs(sinon.match(/file.js$/)).returns("console.log('Hello');")
Expand All @@ -495,7 +495,7 @@ exports.group = {

testExcludePath: function (test) {
var run = this.sinon.stub(cli, "run");
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

cli.interpret([
Expand All @@ -505,7 +505,7 @@ exports.group = {
test.equal(run.args[0][0].ignores[0], path.resolve(dir, "exclude.js"));

run.restore();
process.cwd.returns(__dirname + "/../");
process.cwd.returns(path.join(__dirname, "/../"));

this.sinon.stub(shjs, "cat")
.withArgs(sinon.match(/file.js$/)).returns("console.log('Hello');")
Expand All @@ -517,7 +517,7 @@ exports.group = {
},

testAPIIgnores: function (test) {
var dir = __dirname + "/../data/";
var dir = path.join(__dirname, "/../data/");
this.sinon.stub(process, "cwd").returns(dir);
var result = null;

Expand Down Expand Up @@ -623,7 +623,7 @@ exports.group = {
},

testGather: function (test) {
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
var files = [];
this.sinon.stub(process, "cwd").returns(dir);

Expand Down Expand Up @@ -708,7 +708,7 @@ exports.group = {
shjs.cat.restore();
process.cwd.restore();

this.sinon.stub(process, "cwd").returns(__dirname + "/../");
this.sinon.stub(process, "cwd").returns(path.join(__dirname, "/../"));
this.sinon.stub(shjs, "cat")
.withArgs(sinon.match(/reporter\.js$/)).returns("console.log('Hello');");

Expand All @@ -727,7 +727,7 @@ exports.group = {

testStatusCode: function (test) {
var rep = require("../examples/reporter.js");
var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(rep, "reporter");
this.sinon.stub(process, "cwd").returns(dir);

Expand Down Expand Up @@ -819,7 +819,7 @@ exports.extract = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var html = [
Expand Down Expand Up @@ -860,7 +860,7 @@ exports.extract = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var html = [
Expand Down Expand Up @@ -907,7 +907,7 @@ exports.extract = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var html = [
Expand Down Expand Up @@ -951,7 +951,7 @@ exports.extract = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var html = [
Expand Down Expand Up @@ -1011,7 +1011,7 @@ exports.useStdin = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var jshintrc = JSON.stringify({ undef: true });
Expand Down Expand Up @@ -1050,7 +1050,7 @@ exports.useStdin = {
errors = errors.concat(res);
});

var dir = __dirname + "/../examples/";
var dir = path.join(__dirname, "/../examples/");
this.sinon.stub(process, "cwd").returns(dir);

var jshintrc = JSON.stringify({
Expand Down
3 changes: 2 additions & 1 deletion tests/helpers/fixture.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*jshint node:true, undef:true, maxlen:100 */

var fs = require('fs');
var path = require('path');

exports.fixture = function (name) {
return fs.readFileSync(__dirname + '/../unit/fixtures/' + name).toString();
return fs.readFileSync(path.join(__dirname, '/../unit/fixtures/', name)).toString();
};
4 changes: 3 additions & 1 deletion tests/regression/npm.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use strict";

var path = require("path");

exports.npm = function (test) {
var jshint;
test.ok(jshint = require(__dirname + '/../../'));
test.ok(jshint = require(path.join(__dirname, '/../../')));
test.equal(typeof(jshint.JSHINT), 'function');
test.done();
};

0 comments on commit f5a8748

Please sign in to comment.