Skip to content

chore: update module test for full check#7510

Merged
jasonsaayman merged 7 commits intov1.xfrom
chore/tests-final-updates
Mar 15, 2026
Merged

chore: update module test for full check#7510
jasonsaayman merged 7 commits intov1.xfrom
chore/tests-final-updates

Conversation

@jasonsaayman
Copy link
Copy Markdown
Member

@jasonsaayman jasonsaayman commented Mar 15, 2026

Summary by cubic

Adds ESM and CJS module test suites and smoke tests, wires them into CI across Node 12–18, fixes the CJS smoke import, and raises CJS test timeouts for CI stability. Also verifies the ESM deep import of axios/unsafe/core/settle.js.

Description

  • Add module suites: CJS with mocha (10s timeout), ESM with vitest (60s timeout).
  • Add smoke tests for default/named exports and deep import axios/unsafe/core/settle.js.
  • Fix CJS smoke to validate named exports from require('axios') and pass consistently.
  • Add helpers for fixture create/cleanup (with rmSync fallback) and command execution with clearer errors.
  • New scripts: test:smoke:cjs:vitest, test:smoke:esm:vitest, test:module:cjs, test:module:esm.
  • CI: add cjs-module-tests job (Node 12, 14, 16, 18) in .github/workflows/run-ci.yml, uses npm cache for tests/module/cjs/package-lock.json, downloads axios-tarball, and depends on build-and-run-vitest.

Testing

  • CJS: type-check and compile TS for require('axios') and require('axios').default; smoke tests assert named exports; mocha timeout set to 10s.
  • ESM: type-check and compile TS for import axios; smoke tests validate deep import axios/unsafe/core/settle.js; vitest testTimeout set to 60s.
  • Fixture cleanup tests confirm temp dir removal without shelling out to rm.

Written for commit db732f2. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this Mar 15, 2026
@jasonsaayman jasonsaayman added priority::medium A medium priority commit::test The PR is related to tests labels Mar 15, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

7 issues found across 18 files

Confidence score: 2/5

  • Merge risk is high because several medium-severity, high-confidence issues are concrete failures: package.json references a missing child script, so npm run test:smoke:cjs:vitest will fail immediately.
  • Multiple assertions in tests/smoke/esm/tests/import.smoke.test.js compare typeof strings to constructors (AxiosHeaders, AxiosError, CanceledError), which can cause smoke tests to fail even when exports are correct.
  • Test portability is also at risk: cleanup in tests/module/cjs/tests/helpers/fixture.cjs and tests/module/esm/tests/helpers/fixture.js relies on Unix rm/rm -rf, and tests/module/esm/tests/ts.module.test.js uses a fixture setup that may not resolve axios/Node typings before the interop check runs.
  • Pay close attention to package.json, tests/smoke/esm/tests/import.smoke.test.js, tests/module/cjs/tests/helpers/fixture.cjs, tests/module/esm/tests/helpers/fixture.js, tests/module/esm/tests/ts.module.test.js - these are the most likely sources of immediate CI/test breakage and cross-platform failures.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/module/cjs/tests/helpers/fixture.cjs">

<violation number="1" location="tests/module/cjs/tests/helpers/fixture.cjs:20">
P2: Use Node's filesystem API for cleanup instead of invoking the Unix-only `rm` command, or these tests will fail on non-POSIX environments.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:57">
P2: This command points to a child script that does not exist, so `npm run test:smoke:cjs:vitest` will fail immediately.</violation>
</file>

<file name="tests/module/esm/tests/helpers/fixture.js">

<violation number="1" location="tests/module/esm/tests/helpers/fixture.js:20">
P2: Avoid shelling out to `rm -rf` for fixture cleanup. `runCommand()` invokes the executable directly, so environments without a Unix `rm` binary will fail these tests in the `finally` cleanup path.</violation>
</file>

<file name="tests/smoke/esm/tests/import.smoke.test.js">

<violation number="1" location="tests/smoke/esm/tests/import.smoke.test.js:27">
P2: This assertion compares a `typeof` string to the constructor, so the smoke test will fail even when `axios.CanceledError` is exported correctly.</violation>

<violation number="2" location="tests/smoke/esm/tests/import.smoke.test.js:31">
P2: This assertion compares a `typeof` result to `AxiosError`, which makes the test fail for a valid export.</violation>

<violation number="3" location="tests/smoke/esm/tests/import.smoke.test.js:35">
P2: This assertion uses `typeof` on `axios.AxiosHeaders`, so it compares `'function'` to the constructor instead of checking export equality.</violation>
</file>

<file name="tests/module/esm/tests/ts.module.test.js">

<violation number="1" location="tests/module/esm/tests/ts.module.test.js:25">
P2: This temp fixture does not provide a resolvable `axios` package (or Node typings), so the new test will fail before it can verify TS import interop.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/module/cjs/tests/helpers/fixture.cjs">

<violation number="1" location="tests/module/cjs/tests/helpers/fixture.cjs:19">
P1: `fs.rmSync` breaks the CJS module tests on the Node 12 matrix because that API was only added in later Node releases.</violation>
</file>

<file name="tests/module/esm/tests/helpers/fixture.js">

<violation number="1" location="tests/module/esm/tests/helpers/fixture.js:19">
P2: `fs.rmSync` is not available on the Node 12 CI target, so this cleanup helper will crash there. Use a Node-12-compatible fallback when `fs.rmSync` is missing.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jasonsaayman jasonsaayman merged commit 76794ac into v1.x Mar 15, 2026
20 checks passed
@jasonsaayman jasonsaayman deleted the chore/tests-final-updates branch March 15, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::test The PR is related to tests priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant