-
Notifications
You must be signed in to change notification settings - Fork 142
New test runner #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New test runner #206
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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: | ||
|
|
@@ -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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dropped ipad 6-8 as iphone should cover our testing needs. Open to hearing arguments against. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine nowadays - I wouldn’t stress it. |
||
| - ARTIFACT: 1 | ||
| 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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| 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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. default sauce test browser is ie9. It is typically the most problematic; thus, running |
||
| 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 < $< > $@ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| build/recurly.min.js: build/recurly.js | ||
| @$(BIN)/uglifyjs $< --output $@ | ||
|
|
||
| build/test.js: TESTFILE = $(foreach test, $(TESTS), 'require("./$(test)");') | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This generates a series of requires from the list of test files to act as the main for the test suite. |
||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| components | ||
| build | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the component commits from here on down are due to the test suite dependencies being loaded in the repo root, which is committed. As a bonus, the specs will now run faster since it will not be necessary to download any dependencies during spec runs. |
||
| 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 |
| 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); | ||
| ``` |
| 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" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = function () {}; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| build | ||
| components | ||
| node_modules |
| 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 |
| 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 |
| 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 |
| 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" | ||
| ] | ||
| } |
| 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> |
| 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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loads phantomjs 2.0 in travis. This is important because phantomjs < 2.0 does not support
Function.prototype.bind. Our test suite previously provided a shim -- but I like this solution better. Travis should update to support phantomjs 2.0 soon.