1

I have a legacy web application that have bunch of javascript files. Those files need to be loaded in order and some of them may have duplicate global functions, and all other bad stuffs.

I created javascript modules, which I would like to test with jasmine. Some of these happens to depend on some of old javascript files. If I tried to include all old sources using and , it will blow up since old sources need to be included in order and some of them cannot be included together. Does anyone who have the same situation would like to share how you solve this issue?

I also tried to include the dependent javascript in the script file using $.getScript, however, one of the issue I ran into was that jasmine-maven-plugin ran all the spec in one run. Therefore, $.getScript will load conflict sources and the test blow up again.

cfreak
  • 11
  • 1
  • 1

1 Answers1

0

Looks like the preloadSources configuration property may be what you need:

JavaScript sources (typically vendor/lib dependencies) that need to be loaded before other sources (and specs) in a particular order. Each source will first be searched for relative to ${jsSrcDir}, then ${jsTestSrcDir}, then (if it's not found in either) it will be included exactly as it appears in your POM.

pimlottc
  • 3,066
  • 2
  • 29
  • 24