testdriverai 4.0.79 → 4.0.80

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/index.js CHANGED
@@ -18,9 +18,6 @@ process.removeAllListeners("warning");
18
18
  // package.json is included to get the version number
19
19
  const package = require("./package.json");
20
20
 
21
- // system modules
22
- require("./lib/profiler");
23
-
24
21
  const fs = require("fs");
25
22
  const readline = require("readline");
26
23
  const http = require("http");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.79",
3
+ "version": "4.0.80",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
package/lib/profiler.js DELETED
@@ -1,65 +0,0 @@
1
- // globalTracer.js
2
-
3
- const chalk = require("chalk");
4
- const config = require("./config.js");
5
-
6
- // Save the original function prototype's apply method
7
- const originalApply = Function.prototype.apply;
8
-
9
- // Maximum execution time threshold in milliseconds (30 seconds)
10
- const MAX_EXECUTION_TIME_MS = 30000;
11
-
12
- // Helper function to check if the function is defined in your project files
13
- function isProjectFunction() {
14
- return true;
15
- }
16
-
17
- // Override the apply method to add tracing and timing for project functions only
18
- Function.prototype.apply = function (thisArg, argsArray) {
19
- const functionName = this.name || "anonymous function";
20
-
21
- // Only trace named functions defined in the user's files
22
- if (functionName && isProjectFunction()) {
23
- if (config.TD_PROFILE)
24
- console.log(chalk.cyan(`[profiler] called: ${functionName}`));
25
-
26
- // Start the timer
27
- const startTime = process.hrtime();
28
-
29
- // Call the original function
30
- const result = originalApply.call(this, thisArg, argsArray);
31
-
32
- // End the timer and calculate the elapsed time
33
- const [seconds, nanoseconds] = process.hrtime(startTime);
34
- const elapsedMilliseconds = seconds * 1000 + nanoseconds / 1e6;
35
-
36
- // Log the elapsed time
37
- if (config.TD_PROFILE)
38
- console.log(
39
- chalk.green(
40
- `[profiler] ${functionName} execution time: ${elapsedMilliseconds.toFixed(3)} ms`,
41
- ),
42
- );
43
-
44
- // Check if the execution time exceeds the maximum threshold
45
- if (elapsedMilliseconds > MAX_EXECUTION_TIME_MS) {
46
- console.error(
47
- chalk.red(
48
- `[profiler] Error: Function ${functionName} took too long to execute (${elapsedMilliseconds.toFixed(3)} ms)`,
49
- ),
50
- );
51
- }
52
-
53
- return result;
54
- } else {
55
- // If it's not a named function or not from the user's project, call the function normally
56
- return originalApply.call(this, thisArg, argsArray);
57
- }
58
- };
59
-
60
- if (config.TD_PROFILE)
61
- console.log(
62
- chalk.yellow(
63
- "Global function tracing with timing and error logging for project-defined functions is enabled.",
64
- ),
65
- );