Skip to content

Commit

Permalink
Merge pull request #3874 from terascope/fix-jest-config-top-level-await
Browse files Browse the repository at this point in the history
Fix jest config top level await
  • Loading branch information
sotojn authored Dec 12, 2024
2 parents 4de182f + 6a07c87 commit e4086c1
Show file tree
Hide file tree
Showing 27 changed files with 172 additions and 116 deletions.
1 change: 0 additions & 1 deletion .yarnclean.ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ tests
powered-test

# asset directories
doc
website

# examples
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV NODE_ENV production
ENV YARN_SETUP_ARGS "--prod=false --silent --frozen-lockfile"

COPY package.json yarn.lock tsconfig.json .yarnrc /app/source/
COPY ./patches app/src/patches
COPY .yarnclean.ci /app/source/.yarnclean
COPY .yarn /app/source/.yarn
COPY packages /app/source/packages
Expand Down
7 changes: 2 additions & 5 deletions e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../jest.config.base.js';
import { URL } from 'node:url';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

// TODO: update arrays to run tests specific to platform.
// First array is for tests skipped in kubernetes.
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"docker:listImages": "ts-scripts images list",
"docker:saveImages": "ts-scripts images save",
"docs": "ts-scripts docs",
"postinstall": "patch-package",
"k8s": "TEST_ELASTICSEARCH=true ELASTICSEARCH_PORT=9200 ts-scripts k8s-env",
"k8s:kafka": "TEST_ELASTICSEARCH=true ELASTICSEARCH_PORT=9200 TEST_KAFKA=true KAFKA_PORT=9092 ts-scripts k8s-env",
"k8s:minio": "TEST_MINIO=true MINIO_PORT=9000 TEST_ELASTICSEARCH=true ELASTICSEARCH_PORT=9200 ts-scripts k8s-env",
Expand Down Expand Up @@ -64,6 +65,8 @@
"jest-extended": "~4.0.2",
"jest-watch-typeahead": "~2.2.2",
"node-notifier": "~10.0.1",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"ts-jest": "~29.2.5",
"typescript": "~5.2.2"
},
Expand Down
7 changes: 2 additions & 5 deletions packages/data-mate/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/data-types/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/docker-compose-js/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/elasticsearch-api/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/elasticsearch-store/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/eslint-config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

config.globals.window = {};

Expand Down
7 changes: 2 additions & 5 deletions packages/job-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/scripts/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/terafoundation/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice-cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice-client-js/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice-messaging/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice-state-storage/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice-test-harness/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/teraslice/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/ts-transforms/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/types/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/xlucene-parser/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/xlucene-translator/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
7 changes: 2 additions & 5 deletions packages/xpressions/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import baseConfig from '../../jest.config.base.js';

const dirPath = fileURLToPath(new URL('.', import.meta.url));
const configModulePath = path.join(dirPath, '../../jest.config.base.js');

const module = await import(configModulePath);

const config = module.default(dirPath);
const config = baseConfig(dirPath);

export default config;
14 changes: 14 additions & 0 deletions patches/npm-run-path++unicorn-magic+0.3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/npm-run-path/node_modules/unicorn-magic/package.json b/node_modules/npm-run-path/node_modules/unicorn-magic/package.json
index ac4246d..6688b2c 100644
--- a/node_modules/npm-run-path/node_modules/unicorn-magic/package.json
+++ b/node_modules/npm-run-path/node_modules/unicorn-magic/package.json
@@ -14,7 +14,8 @@
"exports": {
"node": {
"types": "./node.d.ts",
- "import": "./node.js"
+ "import": "./node.js",
+ "default": "./node.js"
},
"default": {
"types": "./default.d.ts",
Loading

0 comments on commit e4086c1

Please sign in to comment.