Skip to content

Commit

Permalink
Prepare testing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
unindented committed May 4, 2013
1 parent 1bda117 commit 7b91141
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 26 deletions.
20 changes: 3 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

node_modules
npm-debug.log

examples/*
/node_modules/
/lib-cov/
/coverage.html
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
all: lint test coverage

clean:
@rm -f coverage.html
@rm -rf lib-cov

lint:
@node_modules/.bin/jshint lib

test:
@node_modules/.bin/mocha

coverage: lib-cov
@SAUCELABS_COV=1 node_modules/.bin/mocha --reporter html-cov > coverage.html

todo:
@fgrep -H -e TODO -e FIXME -r lib test || true

lib-cov:
@jscoverage lib lib-cov

.PHONY: clean lint test coverage todo
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('./lib/Saucelabs');
module.exports = process.env.SAUCELABS_COV ?
require('./lib-cov/Saucelabs') :
require('./lib/Saucelabs');
27 changes: 19 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
{
"author": "Dan Jenkins <dan.jenkins@holidayextras.com> (www.dan-jenkins.co.uk)",
"name": "saucelabs",
"description": "A wrapper around Saucelabs REST API",
"version": "0.0.9",

"name": "saucelabs",
"description": "A wrapper around Sauce Labs REST API",
"version": "0.0.9",

"homepage": "https://github.com/holidayextras/node-saucelabs",

"repository": {
"type": "git",
"url": "git://github.com/holidayextras/node-saucelabs.git"
"url": "git://github.com/holidayextras/node-saucelabs.git"
},
"main": "index.js",
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},

"devDependencies": {
"jshint": "*",
"mocha": "1.9.x",
"chai": "1.5.x",
"nock": "0.17.x"
},

"engines": {
"node": "*"
},

"scripts": {
"test": "make test"
}
}
12 changes: 12 additions & 0 deletions test/Saucelabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var SauceLabs = require('..');

describe('SauceLabs', function () {
var sauce;

describe('#constructor', function () {
it('can be instantiated with `new`', function () {
sauce = new SauceLabs();
sauce.should.be.an.instanceof(SauceLabs);
});
});
});
6 changes: 6 additions & 0 deletions test/bootstrap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Chai
global.chai = require('chai');
global.should = global.chai.should();

// Helpers
global.chai.use(require('../helpers/'));
1 change: 1 addition & 0 deletions test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = function () {};
3 changes: 3 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--require ./test/bootstrap/
--ui bdd
--reporter spec

0 comments on commit 7b91141

Please sign in to comment.