prashant624 / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Loading order is broken if file is specified both in load and serve sections #308

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start jsTestDriver server, v 1.3.3d
2. Run test which consists of few javascript files where loading order matters
Here are examples of configuration file and .js files (also available as 
attachments):

#sample.conf:
server: http://localhost:4224

load:
    - sampleLibrary.js
    - sampleTest.js

serve:
    - sampleLib*.js

//sampleLibrary.js
var sampleLibrary = {name: "sampleLibrary"};

//sampleTest.js
SampleTestCase = TestCase("SampleTestCase");

SampleTestCase.prototype.testMe = function(){
    //here happens error due to missing sampleLibrary
    assertSame(sampleLibrary.name, "sampleLibrary");
};

3. Get some reference errors and failed tests.
4. Repeat all steps without 'serve' section. It runs just well. Example of 
config file:
#sample.conf:
server: http://localhost:4224

load:
    - sampleLibrary.js
    - sampleTest.js

What is the expected output? What do you see instead?

Including file in 'serve' section shouldn't affect effect from 'load' section.
This is essential for working with libraries that dynamically load their 
components (like Dojo, YUI, curl.js etc.) - it makes sense
to put main file in 'load' section and the directory which contains components 
in 'serve' section with wildcart - for example, some/folder/*.js.
If it happens that main file resides in the same directory as components than 
the library will not be loaded at all due to this issue.

What version of the product are you using? On what operating system?
1.3.3d with Google Chrome and Firefox 8 on Windows 7 64 bit.
With 1.3.3c there were no such problem.

Please provide any additional information below.

This seems to happen due to problems with preloading.
In method 
com.google.jstestdriver.server.handlers.pages.TestFileUtil.writeTestFiles() 
there are FileInfo object that represent sampleLibrary.js, both have 
serveOnly=true.
But in com.google.jstestdriver.servlet.fileset.TestCaseUpload.handle() one of 
two FileInfos has serveOnly=false and another serveOnly=true. So, for 
jsTestDriver server it should
be possible to detect that file should be preloaded.

As a workaround it is possible to include all files of 'load' section in 
'serve' section, this way preloading will be disabled.

Original issue reported on code.google.com by Paul.Ly...@gmail.com on 8 Dec 2011 at 1:28

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by Paul.Ly...@gmail.com on 8 Dec 2011 at 1:30

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed at r1102

Original comment by corbinrs...@gmail.com on 28 Dec 2011 at 9:24