@itwin/certa 4.1.0-dev.5 → 4.1.0-dev.7

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.
@@ -27,8 +27,10 @@ app.use("/", (req, resp, next) => {
27
27
  // Handle a special route for serving absolute paths and files from node_modules
28
28
  app.use("/@/", (_req, resp) => {
29
29
  const filePath = _req.originalUrl.replace(/^\/@\//, "");
30
+ const canonicalPath = require("canonical-path");
30
31
  const sourceMap = require("source-map-support").retrieveSourceMap(filePath);
31
- resp.sendFile(path.resolve("/", filePath), {
32
+ const fullPath = path.resolve("/", filePath);
33
+ resp.sendFile(canonicalPath.normalize(fullPath), {
32
34
  headers: (sourceMap) && {
33
35
  "X-SourceMap": `/@/${sourceMap.url}`, // eslint-disable-line @typescript-eslint/naming-convention
34
36
  },
@@ -1 +1 @@
1
- {"version":3,"file":"webserver.js","sourceRoot":"","sources":["../../../src/runners/chrome/webserver.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yDAAyD;AACzD,sCAAsC;AACtC,mCAAmC;AACnC,6BAA6B;AAC7B,6BAA6B;AAE7B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAEtB,2BAA2B;AAC3B,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAChC,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,qLAAqL,CAAC,CAAC;IAClO,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC;AAEH,6FAA6F;AAC7F,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAC/B,IAAI,GAAG,CAAC,IAAI,KAA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sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport * as detect from \"detect-port\";\r\nimport * as express from \"express\";\r\nimport * as http from \"http\";\r\nimport * as path from \"path\";\r\n\r\nconst app = express();\r\n\r\n// Enable CORS for all apis\r\napp.all(\"/*\", (_req, res, next) => {\r\n res.header(\"Access-Control-Allow-Origin\", \"*\");\r\n res.header(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS\");\r\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version\");\r\n next();\r\n});\r\n\r\n// The generated HTML file should be served at the \"root\" URL (i.e., http://localhost:3000/).\r\napp.use(\"/\", (req, resp, next) => {\r\n if (req.path === \"/\")\r\n resp.sendFile(process.env.CERTA_PATH!);\r\n else\r\n next();\r\n});\r\n\r\n// Handle a special route for serving absolute paths and files from node_modules\r\napp.use(\"/@/\", (_req, resp) => {\r\n const filePath = _req.originalUrl.replace(/^\\/@\\//, \"\");\r\n const sourceMap = require(\"source-map-support\").retrieveSourceMap(filePath);\r\n resp.sendFile(path.resolve(\"/\", filePath), {\r\n headers: (sourceMap) && {\r\n \"X-SourceMap\": `/@/${sourceMap.url}`, // eslint-disable-line @typescript-eslint/naming-convention\r\n },\r\n });\r\n});\r\n\r\n// Serve static assets from any configured \"public\" directories\r\nconst publicDirs: string[] = JSON.parse(process.env.CERTA_PUBLIC_DIRS || \"[]\");\r\nfor (const publicDir of publicDirs) {\r\n app.use(express.static(publicDir));\r\n}\r\n\r\n// All other routes should log a warning\r\nconst alreadyLogged = new Set<string>();\r\napp.use(\"*\", (req, resp) => {\r\n // Don't repeat these warnings if the same asset was requested multiple times.\r\n if (!alreadyLogged.has(req.originalUrl)) {\r\n console.warn(`WARNING: Tests attempted to load missing asset: \"${req.originalUrl}\"`);\r\n alreadyLogged.add(req.originalUrl);\r\n }\r\n resp.sendStatus(404);\r\n});\r\n\r\n// Once the server actually starts, we should log and send the actual port back to the parent process\r\nlet port = parseInt(process.env.CERTA_PORT ?? \"3000\", 10);\r\nconst server = http.createServer(app);\r\nserver.on(\"listening\", async () => {\r\n console.log(`Certa web frontend now listening on port ${port}`);\r\n process.send!(port);\r\n});\r\n\r\n// The preferred port (process.env.CERTA_PORT) may be in use. If that happens detect a free port and try again.\r\n// Even though we detect a free port, there can still be race conditions when many certa processes run simultaneously.\r\n// Therefore, we'll retry up to 4 times with a new free port.\r\nconst maxRetries = 4;\r\nlet numRetries = 0;\r\nserver.on(\"error\", async (e: any) => {\r\n if (e.code !== \"EADDRINUSE\" || numRetries >= maxRetries) {\r\n console.error(e);\r\n process.exit(1);\r\n }\r\n try {\r\n numRetries++;\r\n port = await detect(port);\r\n server.close();\r\n server.listen(port);\r\n } catch (error) {\r\n console.error(error);\r\n process.exit(1);\r\n }\r\n});\r\n\r\n// Run the server...\r\nserver.listen(port);\r\n"]}
1
+ {"version":3,"file":"webserver.js","sourceRoot":"","sources":["../../../src/runners/chrome/webserver.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yDAAyD;AACzD,sCAAsC;AACtC,mCAAmC;AACnC,6BAA6B;AAC7B,6BAA6B;AAE7B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAEtB,2BAA2B;AAC3B,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAChC,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,qLAAqL,C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,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACrB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC;AAEH,oBAAoB;AACpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport * as detect from \"detect-port\";\r\nimport * as express from \"express\";\r\nimport * as http from \"http\";\r\nimport * as path from \"path\";\r\n\r\nconst app = express();\r\n\r\n// Enable CORS for all apis\r\napp.all(\"/*\", (_req, res, next) => {\r\n res.header(\"Access-Control-Allow-Origin\", \"*\");\r\n res.header(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS\");\r\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version\");\r\n next();\r\n});\r\n\r\n// The generated HTML file should be served at the \"root\" URL (i.e., http://localhost:3000/).\r\napp.use(\"/\", (req, resp, next) => {\r\n if (req.path === \"/\")\r\n resp.sendFile(process.env.CERTA_PATH!);\r\n else\r\n next();\r\n});\r\n\r\n// Handle a special route for serving absolute paths and files from node_modules\r\napp.use(\"/@/\", (_req, resp) => {\r\n const filePath = _req.originalUrl.replace(/^\\/@\\//, \"\");\r\n const canonicalPath = require(\"canonical-path\");\r\n const sourceMap = require(\"source-map-support\").retrieveSourceMap(filePath);\r\n const fullPath = path.resolve(\"/\", filePath);\r\n resp.sendFile(canonicalPath.normalize(fullPath), {\r\n headers: (sourceMap) && {\r\n \"X-SourceMap\": `/@/${sourceMap.url}`, // eslint-disable-line @typescript-eslint/naming-convention\r\n },\r\n });\r\n});\r\n\r\n// Serve static assets from any configured \"public\" directories\r\nconst publicDirs: string[] = JSON.parse(process.env.CERTA_PUBLIC_DIRS || \"[]\");\r\nfor (const publicDir of publicDirs) {\r\n app.use(express.static(publicDir));\r\n}\r\n\r\n// All other routes should log a warning\r\nconst alreadyLogged = new Set<string>();\r\napp.use(\"*\", (req, resp) => {\r\n // Don't repeat these warnings if the same asset was requested multiple times.\r\n if (!alreadyLogged.has(req.originalUrl)) {\r\n console.warn(`WARNING: Tests attempted to load missing asset: \"${req.originalUrl}\"`);\r\n alreadyLogged.add(req.originalUrl);\r\n }\r\n resp.sendStatus(404);\r\n});\r\n\r\n// Once the server actually starts, we should log and send the actual port back to the parent process\r\nlet port = parseInt(process.env.CERTA_PORT ?? \"3000\", 10);\r\nconst server = http.createServer(app);\r\nserver.on(\"listening\", async () => {\r\n console.log(`Certa web frontend now listening on port ${port}`);\r\n process.send!(port);\r\n});\r\n\r\n// The preferred port (process.env.CERTA_PORT) may be in use. If that happens detect a free port and try again.\r\n// Even though we detect a free port, there can still be race conditions when many certa processes run simultaneously.\r\n// Therefore, we'll retry up to 4 times with a new free port.\r\nconst maxRetries = 4;\r\nlet numRetries = 0;\r\nserver.on(\"error\", async (e: any) => {\r\n if (e.code !== \"EADDRINUSE\" || numRetries >= maxRetries) {\r\n console.error(e);\r\n process.exit(1);\r\n }\r\n try {\r\n numRetries++;\r\n port = await detect(port);\r\n server.close();\r\n server.listen(port);\r\n } catch (error) {\r\n console.error(error);\r\n process.exit(1);\r\n }\r\n});\r\n\r\n// Run the server...\r\nserver.listen(port);\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/certa",
3
- "version": "4.1.0-dev.5",
3
+ "version": "4.1.0-dev.7",
4
4
  "description": "A mocha-based integration test runner",
5
5
  "license": "MIT",
6
6
  "main": "bin/certa.js",
@@ -23,6 +23,7 @@
23
23
  "url": "http://www.bentley.com"
24
24
  },
25
25
  "dependencies": {
26
+ "canonical-path": "^1.0.0",
26
27
  "detect-port": "~1.3.0",
27
28
  "express": "^4.16.3",
28
29
  "jsonc-parser": "~2.0.3",
@@ -46,7 +47,7 @@
46
47
  "nyc": "^15.1.0",
47
48
  "rimraf": "^3.0.2",
48
49
  "typescript": "~5.0.2",
49
- "@itwin/build-tools": "4.1.0-dev.5"
50
+ "@itwin/build-tools": "4.1.0-dev.7"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "electron": ">=23.0.0 <25.0.0"