DevExpress / testcafe-examples

Ready-to-run examples for TestCafe
https://testcafe.io
MIT License
50 stars 53 forks source link

Add an example that shows how to add more strict type checks for t.meta, ClientFunction.dependencies and so on #72

Closed andrzej-woof closed 5 months ago

andrzej-woof commented 2 years ago

What is your Scenario?

I want to have strict type definition for meta object in order to set some properties only within given type boundaries and get utilize IDE suggestions to ease up writing test code For example:

fixture('Fixture');

test('Test', async () => {}).meta({ target: 'staging' });

I want to enforce the type target: 'staging' | 'local';

In addition I'd suggest similar for test/fixture ctx object as I'm setting some shared context properties in before hook

What are you suggesting?

I'm not sure what would be the best way to achieve that Maybe expose generic meta<T>(data: T) functions No clue about best approach for ctx

What alternatives have you considered?

I have to cast everywhere to benefit from static checks and suggestions

Additional context

No response

felis2803 commented 2 years ago

@andrzej-kodify Thank you for the suggestion.