From e3b14976ea81816b7e115da3725570fec65e02ae Mon Sep 17 00:00:00 2001 From: yan Date: Tue, 17 Oct 2023 10:33:32 -0700 Subject: [PATCH] Workaround source-map issue in Node 18 Workaround for https://github.com/mozilla/source-map/issues/454 since we seem to be hitting this error, causing jest reporting to fail. cross-env is needed to make env variable setting work on Windows --- package-lock.json | 28 ++++++++++++++++++++++++++++ package.json | 7 ++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 274fa0bd9e6e..4fc961e36eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,6 +72,7 @@ "babel-loader": "8.2.3", "chalk": "4.1.2", "commander": "2.20.3", + "cross-env": "7.0.3", "css-loader": "3.6.0", "csstype": "2.6.21", "dotenv": "16.3.1", @@ -11782,6 +11783,24 @@ "node": ">= 6" } }, + "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-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", @@ -38530,6 +38549,15 @@ } } }, + "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, + "requires": { + "cross-spawn": "^7.0.1" + } + }, "cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", diff --git a/package.json b/package.json index 4d5718ea5497..fa74c0ee1962 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "format": "node ./build/commands/scripts/commands.js format", "mass_rename": "node ./build/commands/scripts/commands.js mass_rename", "test": "node ./build/commands/scripts/commands.js test", - "test:scripts": "jest build/commands/lib build/commands/scripts", + "test:scripts": "cross-env NODE_OPTIONS=--no-experimental-fetch jest build/commands/lib build/commands/scripts", "test-security": "npm run check_security && npm run audit_deps && npm run network-audit", "tslint": "npm run eslint", "eslint": "eslint ./components", @@ -39,8 +39,8 @@ "web-ui": "webpack --config components/webpack/webpack.config.js --colors", "build-storybook": "build-storybook -c .storybook -o .storybook-out", "storybook": "start-storybook", - "test-unit": "jest -t", - "test-unit:wallet": "jest --coverage=false components/brave_wallet_ui", + "test-unit": "cross-env NODE_OPTIONS=--no-experimental-fetch jest -t", + "test-unit:wallet": "cross-env NODE_OPTIONS=--no-experimental-fetch jest --coverage=false components/brave_wallet_ui", "test-python-scripts": "npm run pep8 && PYTHONPATH=./script python -m unittest discover -s ./script/test", "update_symlink": "node ./build/commands/scripts/commands.js update_symlink", "build_fuzzer": "node ./build/commands/scripts/commands.js build_fuzzer", @@ -301,6 +301,7 @@ "babel-loader": "8.2.3", "chalk": "4.1.2", "commander": "2.20.3", + "cross-env": "7.0.3", "css-loader": "3.6.0", "csstype": "2.6.21", "dotenv": "16.3.1",