Skip to content

chore: fix system tests using pack-n-play when running JS#7970

Open
pearigee wants to merge 2 commits intomainfrom
pearigee-fix-system-tests
Open

chore: fix system tests using pack-n-play when running JS#7970
pearigee wants to merge 2 commits intomainfrom
pearigee-fix-system-tests

Conversation

@pearigee
Copy link
Copy Markdown
Contributor

@pearigee pearigee commented Apr 7, 2026

System tests are failing with the following error:

Error: Command failed with exit code 1: npx tsc
Step #6 - "run-tests": �[96mindex.ts�[0m:�[93m21�[0m:�[93m23�[0m - �[91merror�[0m�[90m TS2591: �[0mCannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.

(for example: https://github.com/googleapis/google-cloud-node/pull/7961/checks?check_run_id=70274525122)

At the moment, the system tests are configured to run the JavaScript test as if it were TypeScript:

it('JavaScript code', async function() {
    this.timeout(300000);
    const options = {
      packageDir: process.cwd(),
      sample: {
        description: 'JavaScript user can use the library',
        // Running index.js as if it were a TS file.
        ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
      }
    };
    await packNTest(options);
  });

This PR simply updates the tests to instead run index.js as a CJS artifact:

it('JavaScript code', async function() {
    this.timeout(300000);
    const options = {
      packageDir: process.cwd(),
      sample: {
        description: 'JavaScript user can use the library',
        // Modified to run as CJS!
        cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
      }
    };
    await packNTest(options);
  });

Note, this was already fix in the generator in #7943. However, the generator release takes some time (i.e. days). This is meant to unblock PRs immediately.

@pearigee pearigee requested a review from a team as a code owner April 7, 2026 17:19
@quirogas quirogas self-requested a review April 7, 2026 17:34
@pearigee
Copy link
Copy Markdown
Contributor Author

pearigee commented Apr 7, 2026

/gcbrun

Copy link
Copy Markdown
Contributor

@quirogas quirogas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me, let's just make sure the GCB test pass before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants