Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 12:00 UTC
feat(ts/e2e): simplify resolution of nodeVersion: ['current']
jkomyno committed
Jan 29, 2026 at 04:31 UTC
d57d6d7ed423ea55e0d6b03499cb85354642c81b
2 files changed
+12
-34
ts/e2e-tests/_utils/src/config.ts
+11
-33
@@ -33,10 +33,10 @@ export function getRepoRoot(): string {
33
/**
34
* Resolve the Node.js versions to test against, with CI skip state.
35
*
36
+ * The `'current'` version always resolves to the value in `.nvmrc`.
37
+ *
38
* In CI mode (CI env var set + COMPOSIO_E2E_NODE_VERSION set):
37
- * - Returns all configured versions, each with skipInCI computed
39
* - Versions not matching COMPOSIO_E2E_NODE_VERSION are marked to skip
39
- * - 'current' versions only run when COMPOSIO_E2E_NODE_VERSION matches .nvmrc
40
*
41
* In local mode:
42
* - COMPOSIO_E2E_NODE_VERSION overrides everything (single version, no skip)
@@ -46,30 +46,23 @@ export function resolveNodeVersionMetaList(
46
configNodeVersions?: readonly NodeVersionFromUser[]
47
): NonEmptyArray<NodeVersionMeta> {
48
const envVersion = Bun.env.COMPOSIO_E2E_NODE_VERSION;
49
- const currentNodeVersion = process.versions.node;
49
+ const nvmrcVersion = getNvmrcVersion();
50
51
// Local mode with env override: single version, no skip
52
if (!isCI() && envVersion) {
53
return [{ kind: 'overridden', value: envVersion, skip: { value: false } }];
54
}
55
56
- // No config provided: use current Node version
56
+ // No config provided: use .nvmrc version
57
if (configNodeVersions === undefined || configNodeVersions.length === 0) {
58
- return [{ kind: 'current', value: currentNodeVersion, skip: { value: false } }];
58
+ return [{ kind: 'current', value: nvmrcVersion, skip: { value: false } }];
59
}
60
61
- // Resolve versions with skip state
62
- const nvmrcVersion = getNvmrcVersion();
63
-
61
const resolvedVersions = configNodeVersions.map((v): NodeVersionMeta => {
65
- const isCurrent = v === 'current';
66
- if (isCurrent) {
67
- const skip = computeSkipForVersion(envVersion, currentNodeVersion, isCurrent, nvmrcVersion);
68
- return { kind: 'current', value: currentNodeVersion, skip };
69
- } else {
70
- const skip = computeSkipForVersion(envVersion, v, isCurrent, nvmrcVersion);
71
- return { kind: 'static', value: v, skip };
62
+ if (v === 'current') {
63
+ return { kind: 'current', value: nvmrcVersion, skip: computeSkipForVersion(envVersion, nvmrcVersion) };
64
}
65
+ return { kind: 'static', value: v, skip: computeSkipForVersion(envVersion, v) };
66
});
67
68
return resolvedVersions as NonEmptyArray<NodeVersionMeta>;
@@ -80,27 +73,12 @@ export function resolveNodeVersionMetaList(
73
*/
74
function computeSkipForVersion(
75
envVersion: string | undefined,
83
- versionValue: string,
84
- isCurrent: boolean,
85
- nvmrcVersion: string
76
+ versionValue: string
77
): SkipInCI {
87
- // Not in CI or no env version: don't skip
78
if (!isCI() || !envVersion) {
79
return { value: false };
80
}
81
92
- // 'current' in CI means "run only on .nvmrc version"
93
- if (isCurrent) {
94
- if (envVersion !== nvmrcVersion) {
95
- return {
96
- value: true,
97
- reason: `'current' runs only on .nvmrc version ${nvmrcVersion}`,
98
- };
99
- }
100
- return { value: false };
101
- }
102
-
103
- // Static version: skip if doesn't match env version
82
if (versionValue !== envVersion) {
83
return {
84
value: true,
@@ -113,7 +91,7 @@ function computeSkipForVersion(
91
92
/**
93
* Read the Node.js version from .nvmrc file.
116
- * Used in CI to determine which version 'current' tests should run on.
94
+ * Used to determine the version for 'current' tests.
95
*/
96
export function getNvmrcVersion(): string {
97
try {
@@ -121,7 +99,7 @@ export function getNvmrcVersion(): string {
99
return nvmrc.trim();
100
} catch {
101
console.warn(
124
- 'Failed to read .nvmrc, falling back to current Node version',
102
+ 'Failed to read .nvmrc, falling back to current Node.js version (as read by Bun, so its value is unpredictable)',
103
process.versions.node
104
);
105
return process.versions.node;
ts/e2e-tests/_utils/src/const.ts
+1
-1
@@ -5,7 +5,7 @@ export const WELL_KNOWN_ENV_VARS = ['COMPOSIO_API_KEY', 'OPENAI_API_KEY'] as con
5
6
/**
7
* Node.js versions that are well-known to the CI matrix strategy.
8
- * `current` refers to `process.versions.node`, or (on CI) to the Node.js version specified in `.nvmrc`.
8
+ * `current` refers to the Node.js version specified in `.nvmrc`.
9
*/
10
export const WELL_KNOWN_NODE_VERSIONS = ['20.18.0', '20.19.0', '22.12.0', 'current'] as const;
11