Skip to content

Commit

Permalink
pass node version to jest as an env var
Browse files Browse the repository at this point in the history
  • Loading branch information
busma13 committed Feb 8, 2024
1 parent fd4f25e commit ad6aa72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion e2e/test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const { ElasticsearchTestHelpers } = require('elasticsearch-store');
const { customAlphabet } = require('nanoid');
const path = require('path');
const defaultNodeVersion = require('../../packages/scripts/src/helpers/config.ts');

const {
TEST_INDEX_PREFIX,
Expand Down Expand Up @@ -36,7 +37,7 @@ const {
GENERATE_ONLY,
TEST_OPENSEARCH = false,
TEST_PLATFORM = 'native',
NODE_VERSION = '18.18.2' // keep in sync with NODE_VERSION in packages/scripts/src/helpers/config.ts
NODE_VERSION = defaultNodeVersion
} = process.env;

const TEST_HOST = TEST_OPENSEARCH ? OPENSEARCH_HOST : ELASTICSEARCH_HOST;
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ if (testElasticsearch) {

export const SEARCH_TEST_HOST = testHost;

export const defaultNodeVersion = '18.18.2';
// This overrides the value in the Dockerfile
// keep default in sync with NODE_VERSION in Dockerfile and e2e/test/config.js
export const NODE_VERSION = process.env.NODE_VERSION || '18.18.2';
export const NODE_VERSION = process.env.NODE_VERSION || defaultNodeVersion;

export const {
TEST_PLATFORM = 'native',
Expand Down
3 changes: 2 additions & 1 deletion packages/scripts/src/helpers/test-runner/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export function getEnv(options: TestOptions, suite?: string): ExecEnv {
NODE_ENV: 'test',
FORCE_COLOR: config.FORCE_COLOR,
TEST_NAMESPACE: config.TEST_NAMESPACE,
TZ: 'utc'
TZ: 'utc',
NODE_VERSION: options.nodeVersion
};

if (config.DOCKER_NETWORK_NAME) {
Expand Down

0 comments on commit ad6aa72

Please sign in to comment.