Placeholders and host hooks
Placeholders {…}
| Form | Typical use |
|---|---|
{organization} | First entity ID via context.entities.node |
{organization.1} | Indexed setup entity |
{podcastPath} | Scenario vars value |
{setup.…} | Nested value from setup |
{greet('world')} | App-registered helper (not built in) |
No eval. Unknown helpers fail closed. Nested helper calls are unsupported — compose via vars or a combined helper.
const { registerHelper, registerYamlTests } = require('smky');
registerHelper('ids', (entity, type) => []);
registerHelper('nodePath', (bundle) => '/');
registerYamlTests({
test,
expect,
root: __dirname + '/features',
hooks: {
async applySetup() {
return { entities: { node: { organization: [{ id: 1 }] } } };
},
async login({ page }) {
await page.goto('/login.html');
},
async teardown() {},
},
});
Host plugins (roles / setup / teardown)
YAML may declare these keys; smky does not interpret them itself.
| YAML | Hook | If hook missing |
|---|---|---|
setup | hooks.applySetup | Allowed — static placeholder data |
roles / setup_login | hooks.login | Scenario skipped |
teardown | hooks.teardown | No-op (+ one-time warn) |
Also: beforeDocument / beforeScenario / afterScenario / afterDocument (document hooks use describe.serial beforeAll / afterAll).
See examples/host-demo.smky.spec.js for stubs. Pure smoke YAML needs no hooks.