-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
(Created from #823)
While hot reloading will reload a changed file, it does not appear that changes are actually used. For example, a changed file in the paths/ directory will be reloaded. However, those changes have no effect until the _.context.ts file is reloaded as well.
Steps to reproduce
Setup
Have a file structure like so:
counterfact/
paths/
_mocks/
my-custom-code.ts
_.context.ts
In _.context.ts:
import { CustomClass } from './_mocks/my-custom-code';
console.log("_.context.ts loaded");
// Do stuff with CustomClassIn ./_mocks/my-custom-code:
console.log("Custom code loaded");
const value = "Some value that's used in generating a mock response";
class CustomClass {
// Use value in here somehow as part of generating a response
}
export { CustomClass }Trigger
- Run counterfact (ex:
npx counterfact spec.openapi.yaml counterfact) - Call counterfact api, see the
"Some value..."in the HTTP response - Modify the custom code string to be something else (
"const value = "Changed!") - Note that
Custom code loadedis logged - Make a request to counterfact. Note that the new value is not returned
However, if I trivially modify the _.context.ts file (touch it, add a comment, etc), I do see counterfact log the _.context.ts loaded message. If I then make a new HTTP request, I see the new value in the mock http response.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working