{"record":{"id":"765ec5e27c16176a","repo":"SeleniumHQ/selenium","slug":"expected-input-and-output-file-paths-765ec5","errorCode":null,"errorMessage":"Expected input and output file paths","messagePattern":"Expected input and output file paths","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/atoms/typescript/wrap-as-global.js","lineNumber":27,"sourceCode":"//   http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied.  See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n// Wraps the compiled isShown TypeScript output as a browser global so that\n// test HTML pages can load it directly via <script> and access it as\n// window.bot.dom.typescript.isShown.\n\nconst fs = require('node:fs');\n\nconst [inputPath, outputPath] = process.argv.slice(2);\n\nif (!inputPath || !outputPath) {\n  throw new Error('Expected input and output file paths');\n}\n\nconst licenseHeader = `// Licensed to the Software Freedom Conservancy (SFC) under one\n// or more contributor license agreements.  See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership.  The SFC licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License.  You may obtain a copy of the License at\n//\n//   http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied.  See the License for the\n// specific language governing permissions and limitations\n// under the License.`;","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/atoms/typescript/wrap-as-global.js#L9-L45","documentation":"wrap-as-global.js wraps the compiled isShown TypeScript output into a browser-global assignment (window.bot.dom.typescript.isShown = ...) so test HTML fixtures can load it via a plain <script> tag. Like the other wrap scripts, it requires exactly two positional CLI args [inputPath, outputPath]; missing either aborts before reading the file. It is a Bazel build-time helper, not shipped to end users.","triggerScenarios":"Running `node wrap-as-global.js` with fewer than two arguments. A Bazel rule referencing the script without substituting both $(location) input/output labels. Passing undefined/empty strings from a misconfigured macro.","commonSituations":"Modifying the TypeScript atoms BUILD file and forgetting to thread the output path. Local manual invocation during atom development. A refactor that renamed the output target so the location expansion yields nothing.","solutions":["Invoke as: node wrap-as-global.js <compiled-input.js> <wrapped-output.js>.","Confirm the Bazel rule passes both input and output $(location) expansions.","Verify the tsc compile step produced the input file before this wrapping step.","Run the full Bazel target (e.g. bazel build //javascript/atoms/typescript:is_displayed) rather than invoking the script directly."],"exampleFix":"// before\nnode javascript/atoms/typescript/wrap-as-global.js is-displayed.compiled.js\n\n// after\nnode javascript/atoms/typescript/wrap-as-global.js is-displayed.compiled.js is-displayed.global.js","handlingStrategy":"validation","validationCode":"const [inputPath, outputPath] = process.argv.slice(2)\nif (!inputPath || !outputPath) {\n  console.error('Usage: wrap-as-global.js <input.js> <output.js>')\n  process.exit(2)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Supply both input and output paths when invoking.","Verify both $(location) substitutions resolve in the Bazel rule.","Run the Bazel target rather than the bare script.","Confirm the compiled input exists before wrapping."],"tags":["build","nodejs","bazel","atoms","cli","typescript"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}