SeleniumHQ/selenium · error · Error

Expected input and output file paths

Error message

Expected input and output file paths

What it means

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.

Source

Thrown at javascript/atoms/typescript/wrap-as-global.js:27

//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

// Wraps the compiled isShown TypeScript output as a browser global so that
// test HTML pages can load it directly via <script> and access it as
// window.bot.dom.typescript.isShown.

const fs = require('node:fs');

const [inputPath, outputPath] = process.argv.slice(2);

if (!inputPath || !outputPath) {
  throw new Error('Expected input and output file paths');
}

const licenseHeader = `// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.`;

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Invoke as: node wrap-as-global.js <compiled-input.js> <wrapped-output.js>.
  2. Confirm the Bazel rule passes both input and output $(location) expansions.
  3. Verify the tsc compile step produced the input file before this wrapping step.
  4. Run the full Bazel target (e.g. bazel build //javascript/atoms/typescript:is_displayed) rather than invoking the script directly.

Example fix

// before
node javascript/atoms/typescript/wrap-as-global.js is-displayed.compiled.js

// after
node javascript/atoms/typescript/wrap-as-global.js is-displayed.compiled.js is-displayed.global.js
Defensive patterns

Strategy: validation

Validate before calling

const [inputPath, outputPath] = process.argv.slice(2)
if (!inputPath || !outputPath) {
  console.error('Usage: wrap-as-global.js <input.js> <output.js>')
  process.exit(2)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/765ec5e27c16176a. Report an issue: GitHub.