Skip to content
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

question: how does --pathname work? #28

Closed
matthewmueller opened this issue Aug 25, 2014 · 5 comments
Closed

question: how does --pathname work? #28

matthewmueller opened this issue Aug 25, 2014 · 5 comments

Comments

@matthewmueller
Copy link
Contributor

Playing around with duo-test(1). Really cool, still think it needs more docs though. Maybe just a getting started section.

Question about how you use pathname. It seems like you build your test files into build.js, so something like:

$ duo test/*.js && duo test browser

So how does --pathname apply?

@yields
Copy link
Contributor

yields commented Aug 25, 2014

--pathname is default to /test/ it's the URL pathname.

so suppose the cwd is my-component the server will serve files from there, so you have to set the tests pathname where the index.html is located.

I decided to go with --pathname because most ? devs will build to my-component/build.js or my-component/build/build.js etc.., so you would rarely build to my-component/tests/build.js.

@stephenmathieson
Copy link
Contributor

I decided to go with --pathname because most ? devs will build to my-component/build.js or my-component/build/build.js etc.., so you would rarely build to my-component/tests/build.js.

yeah, I'm putting my "built" test file in ./build/tests.js:

JS = $(wildcard index.js lib/*/*.js)
STYL = $(wildcard lib/*/*.styl)
TESTS = $(filter-out test/index.js, $(wildcard test/*.js))
TEST_ENTRY = test/index.js

test: build/tests.js
  @$(NODE) $(BIN)/duo-test \
    --build $^ \
    --reporter spec \
    phantomjs

build/tests.js: $(TESTS) $(TEST_ENTRY)
  @mkdir -p $(dir $@)
  @$(BIN)/duo \
    --root . \
    --development \
    $(TEST_ENTRY) > $@

$(TEST_ENTRY): $(JS) $(TESTS)
  @echo '// GENERATED FILE.  DO NOT EDIT.' > $@
  @$(foreach test, $(TESTS), echo 'require("./$(test)");' >> $@;)

.PHONY: test

@yields
Copy link
Contributor

yields commented Aug 25, 2014

@stephenmathieson yup, but most devs won't do that and get confused i think. (btw nice Makefile haha)

@stephenmathieson
Copy link
Contributor

@matthewmueller can we close?

@matthewmueller
Copy link
Contributor Author

yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants