@testsmith/perfornium 0.5.0 → 0.6.0
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/dist/dashboard/server.js +12 -7
- package/package.json +1 -1
package/dist/dashboard/server.js
CHANGED
|
@@ -278,9 +278,11 @@ class DashboardServer {
|
|
|
278
278
|
async handleRunTest(req, res) {
|
|
279
279
|
const body = await this.readBody(req);
|
|
280
280
|
const { testPath, options } = JSON.parse(body);
|
|
281
|
+
// Normalize the test path to use native separators for the OS
|
|
282
|
+
const normalizedTestPath = path.normalize(testPath);
|
|
281
283
|
const testId = `run-${Date.now()}`;
|
|
282
|
-
const testName = path.basename(
|
|
283
|
-
const args = ['run',
|
|
284
|
+
const testName = path.basename(normalizedTestPath).replace(/\.(yml|yaml|json)$/, '');
|
|
285
|
+
const args = ['run', normalizedTestPath];
|
|
284
286
|
if (options?.verbose)
|
|
285
287
|
args.push('-v');
|
|
286
288
|
if (options?.report)
|
|
@@ -574,18 +576,21 @@ class DashboardServer {
|
|
|
574
576
|
}
|
|
575
577
|
const stat = await fs.stat(fullPath);
|
|
576
578
|
const relativePath = path.relative(baseDir, fullPath);
|
|
577
|
-
// Detect test type from content or path
|
|
579
|
+
// Detect test type from content or path (use forward slashes for cross-platform matching)
|
|
580
|
+
const normalizedPath = fullPath.replace(/\\/g, '/');
|
|
578
581
|
let testType = 'api';
|
|
579
|
-
if (content.includes('protocol: web') || content.includes('playwright') ||
|
|
582
|
+
if (content.includes('protocol: web') || content.includes('playwright') || normalizedPath.includes('/web/')) {
|
|
580
583
|
testType = 'web';
|
|
581
584
|
}
|
|
582
|
-
else if (content.includes('protocol: http') || content.includes('protocol: https') ||
|
|
585
|
+
else if (content.includes('protocol: http') || content.includes('protocol: https') || normalizedPath.includes('/api/')) {
|
|
583
586
|
testType = 'api';
|
|
584
587
|
}
|
|
588
|
+
// Normalize paths to forward slashes for cross-platform compatibility
|
|
589
|
+
const normalizedRelativePath = relativePath.replace(/\\/g, '/');
|
|
585
590
|
tests.push({
|
|
586
591
|
name: entry.name.replace(/\.(yml|yaml|json)$/, ''),
|
|
587
|
-
path: fullPath,
|
|
588
|
-
relativePath,
|
|
592
|
+
path: fullPath, // Keep native path for filesystem operations
|
|
593
|
+
relativePath: normalizedRelativePath, // Use forward slashes for display/URLs
|
|
589
594
|
type: testType,
|
|
590
595
|
lastModified: stat.mtime.toISOString()
|
|
591
596
|
});
|