Getting quench running

Having some trouble getting going with Quench, if anyone can point me in the right direction. I feel like I must me missing something simple. I've installed the package into my dev environment, and I get the UI in Foundry and the example tests run. In my system module code, though, I can't get it running. I've copied in the nonsense tests into ./tests, a directory at the root of my project. I've imported registerExampleTests into my .mjs entrypoint and tried to register the hook like:
Hooks.on("quenchReady", (quench) => {
registerExampleTests(quench);
})
Hooks.on("quenchReady", (quench) => {
registerExampleTests(quench);
})
... but my copies of the example tests are not running. If anyone can tell me where I'm going wrong, I'd appreciate it. Thanks.
5 Replies
Ethaks
Ethaks5mo ago
What tests are shown – did you deactivate the example tests? For a minimal version, try something cut down to the bare necessities:
Hooks.on("quenchReady", (quench) => {
quench.registerBatch(
"YourModuleId.basic",
(context) => {
const { describe, it, assert } = context;

describe("Basic Suite", function () {
it("should run", function () {
assert.ok(true);
});
});
},
{ displayName: "YourModuleName: Basic Test" },
);
});
Hooks.on("quenchReady", (quench) => {
quench.registerBatch(
"YourModuleId.basic",
(context) => {
const { describe, it, assert } = context;

describe("Basic Suite", function () {
it("should run", function () {
assert.ok(true);
});
});
},
{ displayName: "YourModuleName: Basic Test" },
);
});
I've copied in the nonsense tests into ./tests
Quench itself is written in :typescript: – did you remove the types, or did you try to import the file as-is into JS?
CommanderTso
CommanderTsoOP5mo ago
Thanks for the response! - Yes, I deactivated the example tests - I did remove the typing from the nonsense tests, after which my linter was happy - Right now it's picking up no tests at all, even with the minimal version you posted. I'm placing that right into my sinless-foundry-system.mjs that sits in module and is referenced by the esmodules array in system.json.
I'm not doing any quench related includes in my project - I've only installed it into my dev Foundry server. Did I miss needing to do anything at the module level?
Ethaks
Ethaks5mo ago
Check the console for any potential errors (possibly also the hidden group at the top of the log), and try setting a breakpoint or adding a console.log in the hook. If the module itself runs, there should be no further action required other than running code that uses the hook (and ensuring the hook is registered early enough to actually make use of the hook – so no nesting above snipped inside a ready hook or something like that).
CommanderTso
CommanderTsoOP5mo ago
Thanks. I got it working now - still not sure what the issue was (no errors in the log, I don't think anything was nested...), but commenting the simpler invocation back in worked this time.
Thanks again for the support, and for the module. I'm psyched to have this as a tool.
Ethaks
Ethaks5mo ago
If you encounter any further issues, don't hesitate to ping me – testing's dear to me, so I try to help out wherever I can 🙂
Want results from more Discord servers?
Add your server