Skip to content

Commit a545d6d

Browse files
author
naman-contentstack
committed
added condition to debug test case
1 parent 59e0b0e commit a545d6d

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ module.exports = {
1111
"unicorn/no-abusive-eslint-disable": "off",
1212
"@typescript-eslint/no-use-before-define": "off",
1313
"node/no-missing-import": "off",
14-
"@typescript-eslint/no-explicit-any": "warn",
14+
"@typescript-eslint/no-explicit-any": "off",
1515
"@typescript-eslint/no-require-imports": "off",
16-
"no-useless-escape": "warn",
16+
"no-useless-escape": "off",
1717
},
1818
};

tests/integration/tsgen.integration.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { spawnSync } = require("child_process");
1+
import { spawnSync } from "child_process";
22
import * as path from "path";
33
import * as dotenv from "dotenv";
44
import * as fs from "fs";
@@ -16,10 +16,15 @@ describe("Integration Test for tsgen command", () => {
1616
}
1717
});
1818

19+
// Check if tokenAlias is defined before running tests
20+
if (!tokenAlias) {
21+
throw new Error("TOKEN_ALIAS environment variable is not set");
22+
}
23+
1924
// Test case 1: Generate TypeScript types with default flags
2025
it("should generate TypeScript types with the default flags", () => {
2126
const cmd = "csdx";
22-
const args = ["tsgen", "-a", tokenAlias, "-o", outputFilePath];
27+
const args = ["tsgen", "-a", tokenAlias!, "-o", outputFilePath];
2328

2429
const result = spawnSync(cmd, args, { encoding: "utf-8" });
2530

@@ -38,7 +43,7 @@ describe("Integration Test for tsgen command", () => {
3843
const args = [
3944
"tsgen",
4045
"-a",
41-
tokenAlias,
46+
tokenAlias!,
4247
"-o",
4348
outputFilePath,
4449
"-p",
@@ -67,7 +72,7 @@ describe("Integration Test for tsgen command", () => {
6772
// Test case 3: Generate TypeScript types without documentation comments
6873
it("should generate TypeScript types without documentation", () => {
6974
const cmd = "csdx";
70-
const args = ["tsgen", "-a", tokenAlias, "-o", outputFilePath, "--no-doc"];
75+
const args = ["tsgen", "-a", tokenAlias!, "-o", outputFilePath, "--no-doc"];
7176

7277
const result = spawnSync(cmd, args, { encoding: "utf-8" });
7378

@@ -84,7 +89,7 @@ describe("Integration Test for tsgen command", () => {
8489
const args = [
8590
"tsgen",
8691
"-a",
87-
tokenAlias,
92+
tokenAlias!,
8893
"-o",
8994
outputFilePath,
9095
"--include-system-fields",
@@ -117,7 +122,7 @@ describe("Integration Test for tsgen command", () => {
117122
const args = [
118123
"tsgen",
119124
"-a",
120-
tokenAlias,
125+
tokenAlias!,
121126
"-o",
122127
outputFilePath,
123128
"--api-type",
@@ -126,8 +131,6 @@ describe("Integration Test for tsgen command", () => {
126131

127132
const result = spawnSync(cmd, args, { encoding: "utf-8" });
128133

129-
console.error("Spawn Error:", result);
130-
131134
expect(result.status).toBe(0);
132135
expect(fs.existsSync(outputFilePath)).toBeTruthy();
133136

@@ -143,7 +146,7 @@ describe("Integration Test for tsgen command", () => {
143146
const args = [
144147
"tsgen",
145148
"-a",
146-
tokenAlias,
149+
tokenAlias!,
147150
"-o",
148151
outputFilePath,
149152
"--api-type",
@@ -154,8 +157,6 @@ describe("Integration Test for tsgen command", () => {
154157

155158
const result = spawnSync(cmd, args, { encoding: "utf-8" });
156159

157-
console.error("Spawn Error:", result);
158-
159160
expect(result.status).toBe(0);
160161
expect(fs.existsSync(outputFilePath)).toBeTruthy();
161162

0 commit comments

Comments
 (0)