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 143 forks source link

No way to define custom test harness for context menu extension #790

Closed christopher-kiss closed 2 years ago

christopher-kiss commented 3 years ago

The core of our issue that we are facing is that we want to turn off jasmine running tests in random order. This is not a problem when running from the command line because we can specify our own custom test harness, but the extension uses it's own version of the test harness tucked away in the install location of the extension.

As a result it is not possible to configure the test harness used by the context menu, such as run in browser.

It would be great if we can configure which test harness to use when using any of the context menu options.

mmanela commented 3 years ago

You have two options

  1. right-click and run on the html test harness file to run the tests.
  2. Take advantage of customizable HTML harness generation, this lets you tell Chutzpah to generate a harness based on your definition.
christopher-kiss commented 3 years ago

@mmanela,

Thanks, yes I had the https://github.com/mmanela/chutzpah/wiki/customizable-html-harness-generation working, however this only replaces the html file, it does not replace boot.js, jasmine.css, jasmine.js, jasmine_favicon.png and jasmine_html.js.

@@TestFrameworkDependencies@@

When this gets replaced it still points to v3. I know we can specify these files via IsTestFrameworkFile in references, but it would be nice to be able to set CustomTestHarnessPath to just a folder which would assume the existence of all these files and include them without the references needed in chutzpah?

As an alternative, I tried adding the links directly in the html that is replaced and removing (@@TestFrameworkDependencies@@), but this fails since they are not included in the webserver then so the files return 404 error's.

Is there a way to achieve specifying the folder of test harness files, so we don't need to specify all the files in every one of our chutzpah.json files and just point it at the folder instead?

mmanela commented 3 years ago

Those are great points on server mode (the feature was written before that mode existed). Today, there is not a way for you to list the files yourself and you need to leverage the chutzpah.json file. My question for you is why do you need to specify it in more than one chutzpah.json file? Can you have just one parent one that has global references?

christopher-kiss commented 3 years ago

That's a good idea, our current tooling dynamically generates the references portion of chutzpah.json and it's not currently setup with the idea of a parent configuration, but this may not be too difficult to fix with our tooling and may end up just working if I re-shuffle some things. I'll investigate to see if this is feasible for us.

Thank you.

mmanela commented 3 years ago

In the chutzpah.json file you can specify either of these:

    "InheritFromParent": "true|false",

    "InheritFromPath": "<Path to another chutzpah.json>",

The first will have it inherit from the first chutzpah.json file it finds in a directory above the current one, while the second option lets you specify an absolute or relative path to the one to inherit from.

InheritFromParent - Walk up the tree from the current directory to find a parent chutzpah.json file to inherit from. Most properties are simply overridden in a child chutzpah.json file if they exist in both. Howevever, for properties like References and Transforms it will add to the existing list. This helps enable the scenario where you have common references in a parent chutzpah.json file and only have area specific references in a child one. The Tests setting does not inherit.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.