Skip to content

Commit

Permalink
Uses duo-test
Browse files Browse the repository at this point in the history
- Major test infrastructure cleanup
- API mock rewritten as koa middleware
- Makefile rewritten
- Updates travis runners
- Resolves #191

Signed-off-by: Christopher Rogers <chrissrogers@gmail.com>
  • Loading branch information
chrissrogers committed Jun 18, 2015
1 parent 3e152e8 commit 8e30fbb
Show file tree
Hide file tree
Showing 136 changed files with 14,085 additions and 6,078 deletions.
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
language: node_js
script: 'if [ -n "$ARTIFACT" ]; then make test; else make test-sauce; fi'
node_js:
- '0.12'
install:
- mkdir travis-phantomjs
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
- export PATH=$PWD/travis-phantomjs:$PATH
script:
- 'if [ -n "$ARTIFACT" ]; then make test; else make test-sauce; fi'
before_script:
- 'if [ -n "$ARTIFACT" ]; then gem install travis-artifacts; fi'
after_success:
Expand All @@ -19,7 +25,10 @@ env:
- BROWSER: chrome
- BROWSER: firefox
- BROWSER: safari
- BROWSER: ie9..11
- BROWSER: ipad6..8
- BROWSER: iphone6..8
- BROWSER: ie:11
- BROWSER: ie:10
- BROWSER: ie:9
- BROWSER: iphone:8
- BROWSER: iphone:7
- BROWSER: iphone:6
- ARTIFACT: 1
46 changes: 30 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
BIN = node_modules/.bin
DUO = $(BIN)/duo
MINIFY = $(BIN)/uglifyjs
WATCH = $(BIN)/wr
DELEGATE = test test-browser test-sauce test-coverage
T = $(BIN)/duo-test -m test/api.js -R spec -P 8378

BUILD = ./build
WATCH_FILES = lib index.js component.json Makefile
SRC = index.js $(shell find lib -type f -name '*.js')
TESTS = $(wildcard test/*.test.js)

build: node_modules
@mkdir -p $(BUILD)
@$(DUO) --quiet --stdout --global recurly index.js > $(BUILD)/recurly.js
@$(MINIFY) $(BUILD)/recurly.js --output $(BUILD)/recurly.min.js
test: test-phantomjs

test-phantomjs: build/recurly.min.js build/test.js
@$(T) phantomjs

test-browser: build/recurly.min.js build/test.js
@$(T) browser

test-sauce: BROWSER ?= ie:9
test-sauce: build/recurly.min.js build/test.js
@$(T) saucelabs -b $(BROWSER)

build: build/recurly.min.js

build/recurly.js: index.js $(SRC) node_modules component.json
@mkdir -p $(@D)
@$(DUO) --quiet --stdout --global recurly < $< > $@

build/recurly.min.js: build/recurly.js
@$(BIN)/uglifyjs $< --output $@

build/test.js: TESTFILE = $(foreach test, $(TESTS), 'require("./$(test)");')
build/test.js: $(TESTS)
@echo $(TESTFILE) | $(DUO) --quiet --development --type js --stdout > $@

watch: node_modules
@$(WATCH) make $(WATCH_FILES)
@$(BIN)/wr $(MAKE) component.json $(SRC)

node_modules: package.json
@npm install --silent

$(DELEGATE): build
@cd test && make $@

clean:
@rm -rf node_modules components/duo.json $(BUILD)
@cd test && make $@
@rm -rf node_modules components/duo.json build

.PHONY: clean build test test-browser test-sauce test-coverage
.PHONY: test watch clean
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ implementations.

## Build
```bash
$ make
$ make build
```

If you are having issues with the build, try `make clean`

## Test
```bash
$ make test
$ make
```

## Beta Features
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"webmodules/jsonp": "0.0.4",
"yields/cors-xhr": "1.0.1",
"yields/merge": "1.0.0",
"visionmedia/debug": "2.1.3",
"visionmedia/debug": "2.2.0",
"then/promise": "6.0.0",
"kewah/mixin": "0.1.0",
"pluma/par": "0.3.0",
Expand Down
2 changes: 2 additions & 0 deletions components/chrissrogers-noop@master/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
components
build
Empty file.
11 changes: 11 additions & 0 deletions components/chrissrogers-noop@master/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

build: components index.js
@component build --dev

components: component.json
@component install --dev

clean:
rm -rf build components

.PHONY: clean
12 changes: 12 additions & 0 deletions components/chrissrogers-noop@master/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
noop
====

ever just want to do nothing?

```js
var noop = require('noop');

noop('into the void');

myProcessor(data, noop);
```
14 changes: 14 additions & 0 deletions components/chrissrogers-noop@master/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "noop",
"repo": "chrissrogers/noop",
"description": "noop function",
"version": "0.0.1",
"keywords": [
"function"
],
"license": "MIT",
"main": "index.js",
"scripts": [
"index.js"
]
}
1 change: 1 addition & 0 deletions components/chrissrogers-noop@master/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = function () {};
3 changes: 3 additions & 0 deletions components/component-assert@0.5.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
components
node_modules
37 changes: 37 additions & 0 deletions components/component-assert@0.5.0/History.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

0.5.0 / 2014-10-07
==================

* index: Fix .throws() and .doesNotThrow()
* add mocha diff

0.4.0 / 2014-06-30
==================

* fix default assertion messages
* add testing server

0.3.1 / 2014-06-03
==================

* fix custom assertion messages being ignored

0.3.0 / 2013-12-10
==================

* add node assert methods

0.2.0 / 2013-08-15
==================

* update to work with latest component/stack.

0.1.1 / 2012-10-09
==================

* fix paren balancing with greedy capture

0.1.0 / 2012-10-09
==================

* add callsite support for auto-generated messages
20 changes: 20 additions & 0 deletions components/component-assert@0.5.0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

build: components index.js
@component build --dev

components: component.json
@component install --dev

clean:
@rm -fr build components

node_modules: package.json
@npm install

server: node_modules build
@node test/server.js

test: build
@open http://localhost:7575

.PHONY: clean server test
25 changes: 25 additions & 0 deletions components/component-assert@0.5.0/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# assert

C-style assertion lib.

## Example

With custom assertion message:

```js
var assert = require('assert');
assert(expr, 'oh no it broke');
```

Or auto-generated assertion message in
browsers that support `Error.captureStackTrace()`:

```js
var assert = require('assert');
assert(user.name == 'Tobi');
```

## License

MIT
15 changes: 15 additions & 0 deletions components/component-assert@0.5.0/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "assert",
"repo": "component/assert",
"description": "Assertion lib",
"version": "0.5.0",
"keywords": ["assert", "test"],
"dependencies": {
"component/stack": "*",
"jkroso/equals": "*",
"yields/fmt": "0.0.2"
},
"scripts": [
"index.js"
]
}
6 changes: 6 additions & 0 deletions components/component-assert@0.5.0/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<body>
<script src="build/build.js"></script>
<script src="example.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions components/component-assert@0.5.0/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

/**
* Module dependencies.
*/

var assert = require('assert');

function test() {
var user = { name: 'Tobi' };
assert(user.name == 'tobi');
}

test();
Loading

0 comments on commit 8e30fbb

Please sign in to comment.