test-gen-js 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,6 +32,23 @@ This library is not about perfect test automation, but about **lowering the barr
32
32
 
33
33
  ---
34
34
 
35
+ ## 📋 Prerequisites
36
+
37
+ Make sure you have the following packages installed in your project:
38
+
39
+ ```bash
40
+ # Required for TypeScript type checking in test files
41
+ npm install -D @types/jest jest
42
+
43
+ # For React projects
44
+ npm install -D @testing-library/react @testing-library/jest-dom
45
+
46
+ # For React Native projects
47
+ npm install -D @testing-library/react-native
48
+ ```
49
+
50
+ ---
51
+
35
52
  ## 📦 Installation
36
53
 
37
54
  ```bash
@@ -2,6 +2,7 @@
2
2
  const testLib = helpers.getTestingLibrary(analysis.framework);
3
3
  const sourceImport = helpers.getRelativeImport(analysis.filePath.replace(/\.(tsx?|jsx?)$/, '.test.$1'), analysis.filePath);
4
4
  %>
5
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
6
  import React from 'react';
6
7
  import { <%= testLib.imports.join(', ') %> } from '<%= testLib.package %>';
7
8
  <% analysis.components.forEach(component => { %>
@@ -12,7 +13,7 @@ import { <%= component.name %> } from '<%= sourceImport %>';
12
13
  describe('<%= component.name %>', () => {
13
14
  const defaultProps = {
14
15
  <% component.props.forEach((prop, index) => { %>
15
- <%= prop.name %>: <%= helpers.generatePropValue(prop) %><%= index < component.props.length - 1 ? ',' : '' %>
16
+ <%- prop.name %>: <%- helpers.generatePropValue(prop) %><%- index < component.props.length - 1 ? ',' : '' %>
16
17
  <% }); %>
17
18
  };
18
19
 
@@ -1,6 +1,7 @@
1
1
  <%
2
2
  const sourceImport = helpers.getRelativeImport(analysis.filePath.replace(/\.(tsx?|jsx?)$/, '.test.$1'), analysis.filePath);
3
3
  %>
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
5
  <% analysis.functions.forEach(func => { %>
5
6
  import { <%= func.name %> } from '<%= sourceImport %>';
6
7
  <% }); %>
@@ -13,7 +14,7 @@ describe('<%= func.name %>', () => {
13
14
 
14
15
  <% if (func.isAsync) { %>
15
16
  it('should resolve successfully', async () => {
16
- const result = await <%= func.name %>(<%= func.params.map(p => helpers.generateMockValue(p.type)).join(', ') %>);
17
+ const result = await <%- func.name %>(<%- func.params.map(p => helpers.generateMockValue(p.type)).join(', ') %>);
17
18
 
18
19
  // TODO: Add assertions
19
20
  expect(result).toBeDefined();
@@ -27,7 +28,7 @@ describe('<%= func.name %>', () => {
27
28
  });
28
29
  <% } else { %>
29
30
  it('should return expected result', () => {
30
- const result = <%= func.name %>(<%= func.params.map(p => helpers.generateMockValue(p.type)).join(', ') %>);
31
+ const result = <%- func.name %>(<%- func.params.map(p => helpers.generateMockValue(p.type)).join(', ') %>);
31
32
 
32
33
  // TODO: Add assertions
33
34
  expect(result).toBeDefined();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-gen-js",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Auto-generate test boilerplate code for JavaScript/TypeScript, React, and React Native projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",