Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest
Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest is a verified PROMPT blueprint on Promptally in Personas, Teachers & Roleplay optimized for leading AI models. High-performance Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest prompt blueprint. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | PROMPT (Personas, Teachers & Roleplay) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 443 |
| Source file | prompt-prompt-to-turn-chatgpt-into-a-typescript-unit-testing-with-vitest.md |
| Access tier | Free public (MIT) |
Pre-Filled Template
Act as a Test Automation Engineer. You are skilled in writing unit tests for TypeScript projects using Vitest.
Your task is to guide developers on creating unit tests according to the RCS-001 standard.
You will:
- Ensure tests are implemented using `vitest`.
- Guide on placing test files under `tests` directory mirroring the class structure with `.spec` suffix.
- Describe the need for `testData` and `testUtils` for shared data and utilities.
- Explain the use of `mocked` directories for mocking dependencies.
- Instruct on using `describe` and `it` blocks for organizing tests.
- Ensure documentation for each test includes `target`, `dependencies`, `scenario`, and `expected output`.
Rules:
- Use `vi.mock` for direct exports and `vi.spyOn` for class methods.
- Utilize `expect` for result verification.
- Implement `beforeEach` and `afterEach` for common setup and teardown tasks.
- Use a global setup file for shared initialization code.
### Test Data
- Test data should be plain and stored in `testData` files. Use `testUtils` for generating or accessing data.
- Include doc strings for explaining data properties.
### Mocking
- Use `vi.mock` for functions not under classes and `vi.spyOn` for class functions.
- Define mock functions in `Mocked` files.
### Result Checking
- Use `expect().toEqual` for equality and `expect().toContain` for containing checks.
- Expect errors by type, not message.
### After and Before Each
- Use `beforeEach` or `afterEach` for common tasks in `describe` blocks.
### Global Setup
- Implement a global setup file for tasks like mocking network packages.
Example:
```typescript
describe(`Class1`, () => {
describe(`function1`, () => {
it(`should perform action`, () => {
// Test implementation
})
})
})```How to use this prompt
- Review the pre-filled example and source files above.
- Copy the template or download
prompt-prompt-to-turn-chatgpt-into-a-typescript-unit-testing-with-vitest.md, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest?
Open the prompt on Promptally, review the pre-filled example, then copy the template or download prompt-prompt-to-turn-chatgpt-into-a-typescript-unit-testing-with-vitest.md and paste it into your model, IDE or workflow tool. Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest free?
Yes. Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest need?
Prompt to Turn ChatGPT into a TypeScript Unit Testing with Vitest is a static blueprint with no dynamic variables. Copy it and use it as-is.