• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ryanrosello-og / playwright-slack-report / 22010211179

14 Feb 2026 03:20AM UTC coverage: 81.054% (-0.02%) from 81.072%
22010211179

push

github

web-flow
Update dependencies to the latest (#362)

* Refactor code structure for improved readability and maintainability

* chore: upgrade ESLint configuration and dependencies

* feat: enhance ESLint configuration and add import plugin

- Updated eslint.config.js to include eslint-plugin-import and configured import resolver for TypeScript.
- Added rules for import extensions and unresolved imports.
- Updated package.json to include eslint-import-resolver-typescript.
- Refactored ResultsParser.ts to improve error handling and code clarity.
- Cleaned up unnecessary eslint-disable comments in SlackClient.ts and SlackReporter.ts.
- Added error logging in cli_pre_checks.ts for better debugging.
- Updated yarn.lock to include new dependencies and resolve version conflicts.

* fix: update error message for JSON parsing failure in ResultsParser tests

189 of 248 branches covered (76.21%)

Branch coverage included in aggregate %.

7 of 8 new or added lines in 3 files covered. (87.5%)

1 existing line in 1 file now uncovered.

303 of 359 relevant lines covered (84.4%)

13.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/src/cli/cli_pre_checks.ts
1
import { existsSync, PathLike, readFileSync } from 'fs';
2✔
2
import path from 'path';
2✔
3
import { ICliConfig, ZodCliSchema } from './cli_schema';
2✔
4

5
export const doPreChecks = async (
2✔
6
  jsonResultsPath: string,
7
  configFile: string,
8
): Promise<{
9
  status: 'error' | 'ok';
10
  message?: string;
11
  jsonPath?: string;
12
  configPath?: string;
13
  config?: ICliConfig;
14
}> => {
15
  if (!fileExists(jsonResultsPath)) {
10✔
16
    return {
1✔
17
      status: 'error',
18
      message: `JSON results file does not exist: ${jsonResultsPath}:
19
      Use --json-results <path> e.g. --json-results="./results.json"`,
20
    };
21
  }
22

23
  if (!fileExists(configFile)) {
9✔
24
    return {
1✔
25
      status: 'error',
26
      message: `Config file does not exist: ${configFile}`,
27
    };
28
  }
29

30
  const parseResult = { success: false, error: undefined, data: undefined };
8✔
31
  let config: ICliConfig;
32
  try {
8✔
33
    config = getConfig(configFile);
8✔
34
    parseResult.data = ZodCliSchema.parse(config);
8✔
35
    parseResult.success = true;
7✔
36
  } catch (error) {
37
    parseResult.success = false;
1✔
38
    parseResult.error = error;
1✔
39
  }
40

41
  if (!parseResult.success) {
8✔
42
    return {
1✔
43
      status: 'error',
44
      message: `Config file is not valid: ${
3!
45
        parseResult.error.message ?? JSON.stringify(parseResult.error, null, 2)
46
      }`,
47
    };
48
  }
49

50
  if (config.customLayout?.source && !fileExists(config.customLayout?.source)) {
7!
51
    return {
1✔
52
      status: 'error',
53
      message: `Custom layout was not found in path: ${config.customLayout.source}`,
54
    };
55
  }
56

57
  if (config.sendUsingWebhook && config.sendUsingBot) {
6✔
58
    return {
1✔
59
      status: 'error',
60
      message:
61
        'It is not possible to use both sendUsingWebhook and sendUsingBot, choose a single method',
62
    };
63
  }
64

65
  if (config.sendUsingWebhook && config.showInThread) {
5✔
66
    return {
1✔
67
      status: 'error',
68
      message:
69
        'The showInThread feature is only supported when using sendUsingBot is configured',
70
    };
71
  }
72

73
  if (config.sendUsingWebhook && config.sendCustomBlocksInThreadAfterIndex) {
4✔
74
    return {
1✔
75
      status: 'error',
76
      message:
77
        'The sendCustomBlocksInThreadAfterIndex feature is only supported when using sendUsingBot is configured',
78
    };
79
  }
80

81
  if (!config.sendUsingWebhook && !config.sendUsingBot) {
3✔
82
    return {
1✔
83
      status: 'error',
84
      message:
85
        'You must specify either sendUsingWebhook or sendUsingBot in the config file',
86
    };
87
  }
88

89
  if (config.sendUsingBot && !process.env.SLACK_BOT_USER_OAUTH_TOKEN) {
2✔
90
    return {
1✔
91
      status: 'error',
92
      message: 'Missing the SLACK_BOT_USER_OAUTH_TOKEN env variable',
93
    };
94
  }
95

96
  return {
1✔
97
    status: 'ok',
98
    jsonPath: path.resolve(jsonResultsPath),
99
    configPath: path.resolve(configFile),
100
    config: parseResult.data,
101
  };
102
};
2✔
103

104
function fileExists(filePath: string): boolean {
105
  let absolutePath: PathLike;
106
  try {
20✔
107
    absolutePath = path.resolve(filePath);
20✔
108
  } catch (error) {
NEW
109
    console.error(`Error resolving path: ${filePath}`, error);
×
UNCOV
110
    return false;
×
111
  }
112
  return existsSync(absolutePath);
20✔
113
}
114

115
function getConfig(configPath: string): ICliConfig {
116
  const config = readFileSync(path.resolve(path.resolve(configPath)), 'utf-8');
8✔
117
  return JSON.parse(config);
8✔
118
}
2✔
119
export default doPreChecks;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc