mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

Using a polyfill cdn service in 'References' #610

Closed JohnWeisz closed 7 years ago

JohnWeisz commented 7 years ago

This is my chutzpah.json configuration:

"References": {
    "https://cdn.polyfill.io/v2/polyfill.min.js"
}

I'm using this to polyfill missing ES5-6 objects globally. However, Chutzpah uses a path resolver internally that is incompatible with such a URL, and the following stack trace is generated:

Chutzpah Error: Newtonsoft.Json.JsonSerializationException: Error converting value "https://cdn.polyfill.io/v2/polyfill.min.js" to type 'Chutzpah.Models.SettingsFileReference'. Path 'References[0]', line 35, position 52. ---> System.ArgumentException: Could not cast or convert from System.String to Chutzpah.Models.SettingsFileReference.
   a következő helyen: Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   a következő helyen: Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- Vége a belső kivételek veremkivonatának ---
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   a következő helyen: Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   a következő helyen: Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   a következő helyen: Chutzpah.Wrappers.JsonSerializer.DeserializeFromFile[T](String path) hely: C:\Dev\chutzpah\Chutzpah\Wrappers\JsonSerializer.cs, sor: 16
   a következő helyen: Chutzpah.ChutzpahTestSettingsService.ProcessSettingsFile(String directory, ChutzpahSettingsFileEnvironment environment, Boolean forceFresh) hely: C:\Dev\chutzpah\Chutzpah\ChutzpahTestSettingsService.cs, sor: 110
   a következő helyen: Chutzpah.ChutzpahTestSettingsService.FindSettingsFileFromDirectory(String directory, ChutzpahSettingsFileEnvironments environments) hely: C:\Dev\chutzpah\Chutzpah\ChutzpahTestSettingsService.cs, sor: 84
   a következő helyen: Chutzpah.TestRunner.<>c__DisplayClass37_0.<BuildTestRunConfiguration>b__0(PathInfo path) hely: C:\Dev\chutzpah\Chutzpah\TestRunner.cs, sor: 327
   a következő helyen: System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   a következő helyen: System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   a következő helyen: System.Linq.GroupedEnumerable`3.GetEnumerator()
   a következő helyen: Chutzpah.TestRunner.BuildTestRunConfiguration(IEnumerable`1 scriptPaths, TestOptions testOptions) hely: C:\Dev\chutzpah\Chutzpah\TestRunner.cs, sor: 333
   a következő helyen: Chutzpah.TestRunner.ProcessTestPaths(IEnumerable`1 testPaths, TestOptions options, TestExecutionMode testExecutionMode, ITestMethodRunnerCallback callback, IChutzpahWebServerHost activeWebServerHost) hely: C:\Dev\chutzpah\Chutzpah\TestRunner.cs, sor: 222

The stack-trace is reported in Hungarian, but I believe it is absolutely clear what's going on. If I download the polyfill manually and feed the resulting .js file into Chutzpah, it's running flawlessly.

I'm not sure if you intend on providing support for such, presumably rare use cases, but if so, this could be a starting point. Thanks again for authoring Chutzpah, it's a huge productivity booster.

JohnWeisz commented 7 years ago

My apologies, this was a configuration and an IRL memory issue. Closing now.