browsertrix-crawler/tests/invalid-behaviors/invalid-export.js
Ilya Kreymer 703835a7dd
detect invalid custom behaviors on load: (#450)
- on first page, attempt to evaluate the behavior class to ensure it
compiles
- if fails to compile, log exception with fatal and exit
- update behavior gathering code to keep track of behavior filename
- tests: add test for invalid behavior which causes crawl to exit with
fatal exit code (17)
2023-12-13 15:14:53 -05:00

20 lines
333 B
JavaScript

export class TestBehavior {
static init() {
return {
state: {},
};
}
static get id() {
return "TestBehavior";
}
static isMatch() {
return window.location.origin === "https://example.com";
}
async *run(ctx) {
ctx.log("In Test Behavior!");
yield ctx.Lib.getState(ctx, "test-stat");
}
}