Answer by user2297996 for How to put a spy to a single function using SinonJS?
Just to clarify:In order to be able to use Sinon spies, you need to export your module functionality in a certain way. Basically, use classes or objects.Works:export default {func() {},func2()...
View ArticleValidating union type with class-validator?
In a NestJS application I bave multiple DTO classes that utilize class-validator.The controller method expects POST body which can represent any of these DTOs.class A {// some validators}class B {//...
View ArticleAnswer by user2297996 for How to put a spy to a single function using SinonJS?
Just to clarify:In order to be able to use Sinon spies, you need to export your module functionality in a certain way. Basically, use classes or objects.Works:export default {func() {},func2()...
View ArticleHow to use ResolveField decorator with a generic typeFunc?
How to do this in Nestjs Graphql?@ResolveField('items', () => [SomeClass])where SomeClass is any class that implements interface XSo if SomeClass is a specific class then it works. But how to make...
View ArticleComment by user2297996 on How to mock std::something in Rust?
Thanks for the answer, I accepted it. I will go with solution one. I would like to add, though, that even this doesn't seem to be ideal. I mean, yes you can do it this way, but this is not a mock. That...
View ArticleComment by user2297996 on How to mock std::something in Rust?
I don't want to test reading a file. I want to test the logic inside this function, but there are dependencies such as this fs::read(). This is only an example. What I'm looking for is a way to mock /...
View ArticleComment by user2297996 on What's the best way to run shell command from GUI...
@rodrigo so am I supposed to parse those profile files and set the env manually? I was hoping there is a way to do that automatically, but I guess not?
View ArticleEC2 error: cannot create temp file for here-document: Read-only file system
Looks like my Ubuntu 14.04 EC2 made the fs read-only. cd /var/ (pressing tab for autocomplete)cannot create temp file for here-document: Read-only file systemBut I have plenty of free space and memory...
View ArticleHow to run child process in a new thread using Rust / Relm4?
I'm using Rust, GTK4-rs and the Relm4 UI framework.So I have Relm4 SimpleComponent. In its update() method, I have a message handler which spawns a child process to run some task.This is kinda a long...
View ArticleAnswer by user2297996 for How to run child process in a new thread using Rust...
Actually it's possible to do this, there are multiple solutions.Check out this page for an overview:https://relm4.org/book/stable/threads_and_async/index.htmlI used a Component and Commands, basically...
View ArticleHow do I obtain a refernce to widgets in Relm4 Component?
I'm building an app using the Relm4 SimpleComponent / Component macro. It works great. But I don't understand how can I refer to the generated GTK widgets later?My understanding is that the...
View ArticleHow to make Yargs display examples in command specific "help"?
Typing -h prints normal help and I can add examples using the .example() API.However, this is not printed when displaying help for a command:myApp foobar -hormyApp foobar helpI would like to print...
View ArticleHow to prevent Fiber from auto registerting HEAD routes?
Fiber v2 (https://gofiber.io/) automatically adds a HEAD route for each GET route.Is it possible to prevent this?I want only the GETs to be registered. Actually, I want to register only those routes I...
View ArticleHow to customize schematics schema.json?
Is it possible to customise Angular schematics schema.json?I wanna add extra properties to the schema.In other words, I would like top extend the schematics schema.json syntax. How to do...
View ArticleIs there a way to inherit Schema of custom schematic?
Using Angular Schematics, I would like to build a schematic which inherits the schema from a "Base" schematic (which is private and hidden, so it cannot be executed from CLI).So when I run:schematics...
View ArticleHow to print help form Schematics?
Is there a built-in method for printing formatted CLI help message using Angular Schematics. I'm thinking of something something like Yargs would produce, for example.schematics @my-schematic --helpThe...
View ArticleHow to properly use interrupt handlers in 6502 Assembler?
I'm new to assemblers, so this question might sound dumb, but exactly what type of code should be implemented in a raster interrupt handler?So I know this handler gets called when the desired raster...
View ArticleHow to make class-validator to stop on error?
I want class validator to stop validation as soon as the first error is found.I know there is a stopAtFirstError option, but that prevents further validation on property level only. I want to stop it...
View ArticleHow to validate plain object with class-validator?
So I have a DTO:@IsBoolean()someBool: boolean@IsString()someStr: string???someObject: anyHow do I validate someObject? Its value is a plain JS object, just some arbitrary JSON data, so it's NOT another...
View ArticleAnswer by user2297996 for How to validate plain object with class-validator?
This cannot be done using just JSON. You have to create a class type and use that as follows:@IsBoolean()someBool: boolean@IsString()someStr: string@ValidateNested()@Type(() => SomeClass)someObject:...
View Article