2

I need to setup intern to test ajax calls from a different server. I set everything up sort of following the official wiki in this address https://github.com/theintern/intern/wiki/Using-Intern-to-unit-test-Ajax-calls

My config file has proxyUrl set to http://localhost:8080/sub and http://localhost:8080/sub is setup as a reverse proxy to inter-runner in http://localhost:9000

When I run ./node_modules/.bin/intern-runner -config=tests/config from the tests root folder, the browser opens up and is able to request several files, until it tries to request the config file. That's when it receives a 404, because it requests the wrong address - http://localhost:8080/tests/config.js - without the sub folder.

I'm wondering if I'm missing something inside the config file, or if intern is not able to use proxies with subfolders. I tried to set the baseUrl parameter, but it had no effect.

Any ideas?

Update:

It seems that sometimes intern-runner uses the path provided in the config param, and sometimes it uses the one in the proxyUrl parameter inside the config file. As a workaround, what I did was to place the config file and the tests on 2 folders (actually I made a symbolic link). The first on tests/ and the second on sub/tests/ and ran it using ./node_modules/.bin/intern-runner -config=sub/tests/config.

It works, but it's kind of stupid and I really wished there was a better way to do it.

Marco Luglio
  • 3,503
  • 1
  • 21
  • 27

1 Answers1

1

This is indeed a limitation/bug of intern. It assumes that the proxy sits at the root of the absolute domain name, i.e. that it has a pathname of /.

An issue has been created on intern's github repository here and the corresponding pull request that fixes the problem is here. Hopefully this gets merged into the upcoming 2.1 release of intern.

Michael
  • 5,994
  • 7
  • 44
  • 56