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

html file doesnt handle paths correctly #68

Open
jescalan opened this issue Mar 3, 2014 · 3 comments
Open

html file doesnt handle paths correctly #68

jescalan opened this issue Mar 3, 2014 · 3 comments

Comments

@jescalan
Copy link

jescalan commented Mar 3, 2014

One of my most favoritest things about testling is that it produces not only automated test results, but also you can view the tests locally in-browser. For libraries that interact with the DOM, it's great to also be able to visually verify your test cases.

Unfortunately, when you run testling with an html file (which makes it easier to test dom-based javascript), any externally loaded scripts are referenced from the root at which the testling command was run rather than where the file actually is. This means that if your tests are not at the root of your project, which they hardly ever are, you need a different set of paths for your tests to pass and for you to see the tests run locally. For example:

If you have this folder structure:

example-project
˪ package.json
˪ test
  ˪ index.js
  ˪ index.html

...and your html file has these contents...

<div class='foo'>wow such test</div>
<script src='index.js'></script>

...assuming that index.js contains your tests, if you were to open test/index.html, you would see your tests run and all would be well. However, if you were to run $ testling at the root of your project, assuming you have the package.json set up correctly, the tests would not run. If you then change the src of the script in your html file to test/index.js however, the tests will run.

Ideally, when testling ran using an html file, it would load any external paths based on the html file's base path rather than the base path that testling was run from 😀

I haven't looked into to testling's code much, but if you are busy and it would be easier for me to submit a PR, if you point me in the right direction I'd be happy to give this a shot!

jescalan pushed a commit to jescalan/scrollReveal.js that referenced this issue Mar 3, 2014
- based on tape and testling
- does not currently work on testling-ci
- this is probably testling-ci's fault
- does work quite nicely locally
- tape-testing/testling#68
jescalan pushed a commit to jescalan/scrollReveal.js that referenced this issue Mar 3, 2014
- based on tape and testling
- does not currently work on testling-ci
- this is probably testling-ci's fault
- does work quite nicely locally
- tape-testing/testling#68
jescalan pushed a commit to jescalan/scrollReveal.js that referenced this issue Mar 3, 2014
- based on tape and testling
- does not currently work on testling-ci
- this is probably testling-ci's fault
- does work quite nicely locally
- tape-testing/testling#68
jescalan pushed a commit to jescalan/scrollReveal.js that referenced this issue Mar 3, 2014
- based on tape and testling
- does not currently work on testling-ci
- this is probably testling-ci's fault
- does work quite nicely locally
- tape-testing/testling#68
@jebeck
Copy link

jebeck commented Mar 13, 2014

In fact, I believe the issue is even worse than this!

The local $ testling command works as you describe for me as well, but ci.testling.com with the GitHub WebHook behaves as expected - i.e., relative paths from the directory where the html file is stored.

@philipwalton
Copy link

+1

I tried the html option approach to work around a bug where you couldn't specify a script file from the "node_modules" directory. But I'm having just as many problems with relative paths using the html option.

@iclanzan
Copy link

Any updates on this? I am experiencing the same issue.

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

4 participants