Skip to content

Bug: test:snapshot is failed on main branch #84

Closed
@karupanerura

Description

@karupanerura

Steps To Reproduce

pnpm clean && pnpm build
pnpm test:snapshot

The current behavior

pnpm test:snapshot
% pnpm test:snapshot

> @himenon/openapi-typescript-code-generator@0.18.3 test:snapshot /Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator
> jest -c ./jest.snapshot.config.js


 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts
 PASS  test/__tests__/parameter-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts
 FAIL  test/__tests__/unknown-schema-domain-test.ts

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts
  ● Unknown › client.ts

    expect(received).toMatchSnapshot()

    Snapshot name: `Unknown client.ts 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/unknown.schema.domain/client.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 | });
      13 |

      at Object.<anonymous> (test/__tests__/unknown-schema-domain-test.ts:10:18)


 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts
 › 1 snapshot failed.

 RUNS  test/__tests__/template-only-test.ts
 RUNS  test/__tests__/typedef-only-test.ts

 FAIL  test/__tests__/format.domain.ts

  ● Format Types › format.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Format Types format.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/format.domain/code.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 | });
      13 |

      at Object.<anonymous> (test/__tests__/format.domain.ts:10:18)


 › 1 snapshot failed.

 FAIL  test/__tests__/template-only-test.ts

  ● Template Only › api.test.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Template Only api.test.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/api.test.domain.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 |   test("async-api.test.domain", () => {
      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/sync-api.test.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/template-only-test.ts:10:18)

  ● Template Only › async-api.test.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Template Only async-api.test.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/sync-api.test.domain.ts"), { encoding: "utf-8" });
      14 |     const text = Utils.replaceVersionInfo(generateCode);
    > 15 |     expect(text).toMatchSnapshot();
         |                  ^
      16 |   });
      17 |   test("infer.domain", () => {
      18 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/infer.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/template-only-test.ts:15:18)

  ● Template Only › infer.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Template Only infer.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      18 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/infer.domain.ts"), { encoding: "utf-8" });
      19 |     const text = Utils.replaceVersionInfo(generateCode);
    > 20 |     expect(text).toMatchSnapshot();
         |                  ^
      21 |   });
      22 | });
      23 |

      at Object.<anonymous> (test/__tests__/template-only-test.ts:20:18)


 › 3 snapshots failed.

 FAIL  test/__tests__/multi-type.test.domain.ts

  ● Multi Type › types

    expect(received).toMatchSnapshot()

    Snapshot name: `Multi Type types 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.0.1
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/mulit-type-test.domain/types.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 |
      13 |   test("apiClient", () => {

      at Object.<anonymous> (test/__tests__/multi-type.test.domain.ts:10:18)

  ● Multi Type › apiClient

    expect(received).toMatchSnapshot()

    Snapshot name: `Multi Type apiClient 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.0.1
      // 
      // License  : MIT
      // 

      14 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/mulit-type-test.domain/apiClient.ts"), { encoding: "utf-8" });
      15 |     const text = Utils.replaceVersionInfo(generateCode);
    > 16 |     expect(text).toMatchSnapshot();
         |                  ^
      17 |   });
      18 | });
      19 |

      at Object.<anonymous> (test/__tests__/multi-type.test.domain.ts:16:18)


 › 2 snapshots failed.

 FAIL  test/__tests__/typedef-only-test.ts

  ● Typedef only › typedef-api.test.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef only typedef-api.test.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-only/api.test.domain.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 |   test("typedef-infer.domain", () => {
      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-only/infer.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/typedef-only-test.ts:10:18)

  ● Typedef only › typedef-infer.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef only typedef-infer.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-only/infer.domain.ts"), { encoding: "utf-8" });
      14 |     const text = Utils.replaceVersionInfo(generateCode);
    > 15 |     expect(text).toMatchSnapshot();
         |                  ^
      16 |   });
      17 | });
      18 |

      at Object.<anonymous> (test/__tests__/typedef-only-test.ts:15:18)


 › 2 snapshots failed.

 FAIL  test/__tests__/spit-code-test.ts

  ● Split Code › types

    expect(received).toMatchSnapshot()

    Snapshot name: `Split Code types 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/split/types.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 |
      13 |   test("apiClient", () => {

      at Object.<anonymous> (test/__tests__/spit-code-test.ts:10:18)

  ● Split Code › apiClient

    expect(received).toMatchSnapshot()

    Snapshot name: `Split Code apiClient 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      14 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/split/apiClient.ts"), { encoding: "utf-8" });
      15 |     const text = Utils.replaceVersionInfo(generateCode);
    > 16 |     expect(text).toMatchSnapshot();
         |                  ^
      17 |   });
      18 | });
      19 |

      at Object.<anonymous> (test/__tests__/spit-code-test.ts:16:18)


 › 2 snapshots failed.

 FAIL  test/__tests__/argo-rollout-test.ts

  ● Argo Rollout › client.ts

    expect(received).toMatchSnapshot()

    Snapshot name: `Argo Rollout client.ts 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.0.0
      // 
      // 
      ↵

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/argo-rollout/client.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 | });
      13 |

      at Object.<anonymous> (test/__tests__/argo-rollout-test.ts:10:18)


 › 1 snapshot failed.

 FAIL  test/__tests__/typedef-with-template-test.ts
  ● Typedef with template › api.test.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef with template api.test.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/api.test.domain.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 |   test("api.v2.domain", () => {
      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/api.v2.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/typedef-with-template-test.ts:10:18)

  ● Typedef with template › api.v2.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef with template api.v2.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      13 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/api.v2.domain.ts"), { encoding: "utf-8" });
      14 |     const text = Utils.replaceVersionInfo(generateCode);
    > 15 |     expect(text).toMatchSnapshot();
         |                  ^
      16 |   });
      17 |   test("async-api.test.domain", () => {
      18 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/sync-api.test.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/typedef-with-template-test.ts:15:18)

  ● Typedef with template › async-api.test.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef with template async-api.test.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      18 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/sync-api.test.domain.ts"), { encoding: "utf-8" });
      19 |     const text = Utils.replaceVersionInfo(generateCode);
    > 20 |     expect(text).toMatchSnapshot();
         |                  ^
      21 |   });
      22 |   test("infer.domain", () => {
      23 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/infer.domain.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/typedef-with-template-test.ts:20:18)

  ● Typedef with template › infer.domain

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef with template infer.domain 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      23 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/infer.domain.ts"), { encoding: "utf-8" });
      24 |     const text = Utils.replaceVersionInfo(generateCode);
    > 25 |     expect(text).toMatchSnapshot();
         |                  ^
      26 |   });
      27 |   test("ref-access", () => {
      28 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/ref-access.ts"), { encoding: "utf-8" });

      at Object.<anonymous> (test/__tests__/typedef-with-template-test.ts:25:18)

  ● Typedef with template › ref-access

    expect(received).toMatchSnapshot()

    Snapshot name: `Typedef with template ref-access 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.1.0
      // 
      // License  : MIT
      // 

      28 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/ref-access.ts"), { encoding: "utf-8" });
      29 |     const text = Utils.replaceVersionInfo(generateCode);
    > 30 |     expect(text).toMatchSnapshot();
         |                  ^
      31 |   });
      32 | });
      33 |

      at Object.<anonymous> (test/__tests__/typedef-with-template-test.ts:30:18)

 › 5 snapshots failed.
 FAIL  test/__tests__/kubernetes-test.ts
  ● Kubernetes › client-v1.18.5.ts

    expect(received).toMatchSnapshot()

    Snapshot name: `Kubernetes client-v1.18.5.ts 1`

    - Snapshot  - 1
    + Received  + 1

    @@ -1,7 +1,7 @@
      // 
    - // Generated by @himenon/openapi-typescript-code-generator
    + // Generated by dummy-name vdummy
      // 
      // OpenApi : 3.0.0
      // 
      // 
      ↵

       8 |     const generateCode = fs.readFileSync(path.join(__dirname, "../code/kubernetes/client-v1.18.5.ts"), { encoding: "utf-8" });
       9 |     const text = Utils.replaceVersionInfo(generateCode);
    > 10 |     expect(text).toMatchSnapshot();
         |                  ^
      11 |   });
      12 | });
      13 |

      at Object.<anonymous> (test/__tests__/kubernetes-test.ts:10:18)

 › 1 snapshot failed.
 PASS  test/__tests__/client-generate-test.ts (6.861 s)
  ● Console

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrStringArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSON

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)

    console.log
      Warning: Schema could not be identified. Therefore, it is treated as any. io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrStringArray

      at Object.warn (src/internal/Logger/index.ts:19:11)
          at Array.forEach (<anonymous>)


Snapshot Summary
 › 18 snapshots failed from 9 test suites. Inspect your code changes or run `npm run test:snapshot -- -u` to update them.

Test Suites: 9 failed, 2 passed, 11 total
Tests:       18 failed, 4 passed, 22 total
Snapshots:   18 failed, 2 passed, 20 total
Time:        8.013 s, estimated 11 s
Ran all test suites.
 ELIFECYCLE  Command failed with exit code 1.

The expected behavior

pass all snapshot tests

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions