From feebf9781eb97c51a19a4f0622f03d7cde961da0 Mon Sep 17 00:00:00 2001 From: AsafMah Date: Sun, 3 Nov 2024 15:04:33 +0200 Subject: [PATCH] Add cross-env for ESM support in Jest tests (#331) --- .github/workflows/build.yml | 1 - package-lock.json | 19 +++++++++++++++++++ package.json | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edd4058..1a6996b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,6 @@ jobs: AZURE_CLIENT_ID: ${{ secrets.APP_ID }} AZURE_TENANT_ID: ${{ secrets.TENANT_ID }} # Required for running tests when using ESM, see https://kulshekhar.github.io/ts-jest/docs/guides/esm-support - NODE_OPTIONS: "--experimental-vm-modules" - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 - name: Publish Unit Test Results diff --git a/package-lock.json b/package-lock.json index 7e62768..5eed212 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@types/webpack-dev-server": "^4.7.2", "@typescript-eslint/eslint-plugin": "^5.32.0", "@typescript-eslint/parser": "^5.32.0", + "cross-env": "^7.0.3", "eslint": "^8.21.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-header": "^3.1.1", @@ -5583,6 +5584,24 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/package.json b/package.json index 50bf027..1544b78 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "exampleIngest": "npm run build && node packages/azure-kusto-ingest/example.js", "lint": "eslint -c .eslintrc.js --ext .ts .", "lintFix": "eslint --fix -c .eslintrc.js --ext .ts .", - "test": "jest", + "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest", "testE2E": "npm run test -- -t \"E2E Tests\" ", "testNoE2E": "npm run test -- --testPathIgnorePatterns /.*e2e.*/", "testData": "npm run test -- --selectProjects azure-kusto-data", @@ -31,6 +31,7 @@ "@types/webpack-dev-server": "^4.7.2", "@typescript-eslint/eslint-plugin": "^5.32.0", "@typescript-eslint/parser": "^5.32.0", + "cross-env": "^7.0.3", "eslint": "^8.21.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-header": "^3.1.1",