diff --git a/.github/workflows/hyperexecute.yml b/.github/workflows/hyperexecute.yml deleted file mode 100644 index bc9ecbe672..0000000000 --- a/.github/workflows/hyperexecute.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Hyperexecute -on: - workflow_dispatch: - inputs: - username: - required: true - description: LT Username - accessKey: - description: LT Access Key - required: true - sampleRepoLink: - description: Link to the HyperExecute sample repo - default: https://github.com/gauravchawhan/mathjs - required: true -jobs: - HyperExecute-Playwright: - runs-on: ${{ matrix.os }} - timeout-minutes: 15 - strategy: - fail-fast: false - matrix: - os: [windows-latest] - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Starting CLI testing - shell: bash - run: | - echo "STEP 1 ) Downloading sample suite" - git clone https://github.com/gauravchawhan/mathjs - echo "STEP 2) Download CLI and setting environment variables" - cd mathjs - curl https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe -o hyperexecute.exe - export LT_USERNAME=${{ github.event.inputs.username }} - export LT_ACCESS_KEY=${{ github.event.inputs.accessKey }} - ./hyperexecute --user $LT_USERNAME --key $LT_ACCESS_KEY --config hyperexecute.yaml diff --git a/.github/workflows/lambdatest.yaml b/.github/workflows/lambdatest.yaml new file mode 100644 index 0000000000..c882e13206 --- /dev/null +++ b/.github/workflows/lambdatest.yaml @@ -0,0 +1,33 @@ +name: LambdaTest (HyperExecute) +on: + push: + branches: + - '*' + tags: + +jobs: + HyperExecute-Playwright: + runs-on: windows-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + os: [windows-latest] + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Starting CI testing + shell: bash + env: + CI: true + LT_USERNAME: ${{ secrets.LT_USERNAME }} + LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }} + run: | + echo "STEP 1 ) Download project" + git clone https://github.com/josdejong/mathjs + cd mathjs + echo "STEP 2) Download HyperExecute" + curl https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe -o hyperexecute.exe + echo "STEP 3) Run tests using HyperExecute" + ./hyperexecute --user $LT_USERNAME --key $LT_ACCESS_KEY --config test/browser-test-config/lambdatest-hyperexecute-config.yaml diff --git a/AUTHORS b/AUTHORS index 814c40d939..725e839e75 100644 --- a/AUTHORS +++ b/AUTHORS @@ -254,5 +254,6 @@ Vas Sudanagunta Brooks Smith <42363318+smith120bh@users.noreply.github.com> Jmar L. Pineda <63294460+Galm007@users.noreply.github.com> gauravchawhan <117282267+gauravchawhan@users.noreply.github.com> +Neeraj Kumawat <42885320+nkumawat34@users.noreply.github.com> # Generated by tools/update-authors.js diff --git a/HISTORY.md b/HISTORY.md index 1ebe957729..3b933214b1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,8 +1,11 @@ # History -# unpublished changes since 13.2.0 +# 2024-11-06, 13.2.1 - Update to the latest version of `complex.js`. +- Fix `Index.dimension(dim)` accepting non-numeric input. +- Fix: #3290 should validate variables names in method `Parser.set` (#3308). + Thanks @nkumawat34. # 2024-10-02, 13.2.0 diff --git a/hyperexecute.yaml b/hyperexecute.yaml deleted file mode 100644 index 18f181d2dd..0000000000 --- a/hyperexecute.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -version: 0.1 -runson: win # defines the OS to test on - -concurrency: 1 # number of machines to execute the testcases -autosplit: true - -# pre steps sets up the environment for testing -pre: - - npm install - - npm install karma -g - - npm install -g karma-jasmine - - npm install karma-safari-launcher -g - - npm install karma-webdriver-launcher -g - - npm i karma-mocha -g - - npm i karma-webpack -g - - npm i mocha -g - - -# Smart cache -cacheKey: '{{ checksum "package-lock.json" }}' -cacheDirectories: - - node_modules - - # testDiscovery is used to discover all the test cases in test/unit-tests folder -testDiscovery: - type: raw - mode: dynamic - command: grep -nri 'describe' test/unit-tests -ir --include=*.test.js | sed 's/:.*//' - -# command to execute the test cases -testRunnerCommand: karma start test/browser-test-config/lt_karma.js --spec= $test \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2b39bad149..a795be3dc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mathjs", - "version": "13.2.0", + "version": "13.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mathjs", - "version": "13.2.0", + "version": "13.2.1", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.25.7", @@ -38,7 +38,7 @@ "benchmark": "2.1.4", "c8": "10.1.2", "codecov": "3.8.3", - "core-js": "3.38.1", + "core-js": "3.39.0", "del": "8.0.0", "dtslint": "4.2.1", "eslint": "8.57.0", @@ -64,7 +64,7 @@ "karma-mocha-reporter": "2.2.5", "karma-webpack": "5.0.1", "mkdirp": "3.0.1", - "mocha": "10.7.3", + "mocha": "10.8.2", "mocha-junit-reporter": "2.2.1", "ndarray": "1.0.19", "ndarray-determinant": "1.0.0", @@ -78,8 +78,8 @@ "sinon": "19.0.2", "sylvester": "0.0.21", "ts-node": "10.9.2", - "typescript": "5.6.3", - "webpack": "5.95.0", + "typescript": "5.5.4", + "webpack": "5.96.1", "zeros": "1.0.0" }, "engines": { @@ -101,9 +101,9 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.0.tgz", - "integrity": "sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, "license": "MIT", "dependencies": { @@ -116,9 +116,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.0.tgz", - "integrity": "sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.2.tgz", + "integrity": "sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==", "dev": true, "license": "MIT", "engines": { @@ -157,13 +157,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.0.tgz", - "integrity": "sha512-/AIkAmInnWwgEAJGQr9vY0c66Mj6kjkE2ZPB1PurTRaRAh3U+J45sAQMjQDJdh4WbR3l0x5xkimXBKyBXXAu2w==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.2.tgz", + "integrity": "sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.0", + "@babel/parser": "^7.26.2", "@babel/types": "^7.26.0", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", @@ -467,9 +467,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.26.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.1.tgz", - "integrity": "sha512-reoQYNiAJreZNsJzyrDNzFQ+IQ5JFiIzAHJg9bn94S3l+4++J7RsIhNMoB+lgP/9tpmiAQqspv+xfdxTSzREOw==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", + "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1783,9 +1783,9 @@ } }, "node_modules/@definitelytyped/utils/node_modules/@types/node": { - "version": "18.19.59", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.59.tgz", - "integrity": "sha512-vizm2EqwV/7Zay+A6J3tGl9Lhr7CjZe2HmWS988sefiEmsyP9CeXEleho6i4hJk/8UtZAo0bWN4QPZZr83RxvQ==", + "version": "18.19.64", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.64.tgz", + "integrity": "sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2295,9 +2295,9 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "13.0.4", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.4.tgz", - "integrity": "sha512-wpUq+QiKxrWk7U2pdvNSY9fNX62/k+7eEdlQMO0A3rU8tQ+vvzY/WzBhMz+GbQlATXZlXWYQqFWNFcn1SVvThA==", + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -2402,6 +2402,28 @@ "@types/node": "*" } }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -2438,9 +2460,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "version": "22.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz", + "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2661,73 +2683,73 @@ "license": "ISC" }, "node_modules/@webassemblyjs/ast": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", - "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.13.1.tgz", + "integrity": "sha512-+Zp/YJMBws+tg2Nuy5jiFhwvPiSeIB0gPp1Ie/TyqFg69qJ/vRrOKQ7AsFLn3solq5/9ubkBjrGd0UcvFjFsYA==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + "@webassemblyjs/helper-numbers": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.12.1" } }, "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", - "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.12.1.tgz", + "integrity": "sha512-0vqwjuCO3Sa6pO3nfplawORkL1GUgza/H1A62SdXHSFCmAHoRcrtX/yVG3f1LuMYW951cvYRcRt6hThhz4FnCQ==", "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", - "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.12.1.tgz", + "integrity": "sha512-czovmKZdRk4rYauCOuMV/EImC3qyfcqyJuOYyDRYR6PZSOW37VWe26fAZQznbvKjlwJdyxLl6mIfx47Cfz8ykw==", "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", - "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.13.1.tgz", + "integrity": "sha512-J0gf97+D3CavG7aO5XmtwxRWMiMEuxQ6t8Aov8areSnyI5P5fM0HV0m8bE3iLfDQZBhxLCc15tRsFVOGyAJ0ng==", "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", - "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.12.1.tgz", + "integrity": "sha512-Vp6k5nXOMvI9dWJqDGCMvwAc8+G6tI2YziuYWqxk7XYnWHdxEJo19CGpqm/kRh86rJxwYANLGuyreARhM+C9lQ==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/floating-point-hex-parser": "1.12.1", + "@webassemblyjs/helper-api-error": "1.12.1", "@xtuc/long": "4.2.2" } }, "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", - "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.12.1.tgz", + "integrity": "sha512-flsRYmCqN2ZJmvAyNxZXPPFkwKoezeTUczytfBovql8cOjYTr6OTcZvku4UzyKFW0Kj+PgD+UaG8/IdX31EYWg==", "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", - "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.13.1.tgz", + "integrity": "sha512-lcVNbrM5Wm7867lmbU61l+R4dU7emD2X70f9V0PuicvsdVUS5vvXODAxRYGVGBAJ6rWmXMuZKjM0PoeBjAcm2A==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.12.1" + "@webassemblyjs/ast": "1.13.1", + "@webassemblyjs/helper-buffer": "1.13.1", + "@webassemblyjs/helper-wasm-bytecode": "1.12.1", + "@webassemblyjs/wasm-gen": "1.13.1" } }, "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", - "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.12.1.tgz", + "integrity": "sha512-fcrUCqE2dVldeVAHTWFiTiKMS9ivc5jOgB2c30zYOZnm3O54SWeMJWS/HXYK862we2AYHtf6GYuP9xG9J+5zyQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2735,9 +2757,9 @@ } }, "node_modules/@webassemblyjs/leb128": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", - "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.12.1.tgz", + "integrity": "sha512-jOU6pTFNf7aGm46NCrEU7Gj6cVuP55T7+kyo5TU/rCduZ5EdwMPBZwSwwzjPZ3eFXYFCmC5wZdPZN0ZWio6n4Q==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2745,79 +2767,79 @@ } }, "node_modules/@webassemblyjs/utf8": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", - "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.12.1.tgz", + "integrity": "sha512-zcZvnAY3/M28Of012dksIfC26qZQJlj2PQCCvxqlsRJHOYtasp+OvK8nRcg11TKzAAv3ja7Y0NEBMKAjH6ljnw==", "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", - "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.13.1.tgz", + "integrity": "sha512-YHnh/f4P4ggjPB+pcri8Pb2HHwCGK+B8qBE+NeEp/WTMQ7dAjgWTnLhXxUqb6WLOT25TK5m0VTCAKTYw8AKxcg==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-opt": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1", - "@webassemblyjs/wast-printer": "1.12.1" + "@webassemblyjs/ast": "1.13.1", + "@webassemblyjs/helper-buffer": "1.13.1", + "@webassemblyjs/helper-wasm-bytecode": "1.12.1", + "@webassemblyjs/helper-wasm-section": "1.13.1", + "@webassemblyjs/wasm-gen": "1.13.1", + "@webassemblyjs/wasm-opt": "1.13.1", + "@webassemblyjs/wasm-parser": "1.13.1", + "@webassemblyjs/wast-printer": "1.13.1" } }, "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", - "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.13.1.tgz", + "integrity": "sha512-AxWiaqIeLh3c1H+8d1gPgVNXHyKP7jDu2G828Of9/E0/ovVEsh6LjX1QZ6g1tFBHocCwuUHK9O4w35kgojZRqA==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" + "@webassemblyjs/ast": "1.13.1", + "@webassemblyjs/helper-wasm-bytecode": "1.12.1", + "@webassemblyjs/ieee754": "1.12.1", + "@webassemblyjs/leb128": "1.12.1", + "@webassemblyjs/utf8": "1.12.1" } }, "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", - "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.13.1.tgz", + "integrity": "sha512-SUMlvCrfykC7dtWX5g4TSuMmWi9w9tK5kGIdvQMnLuvJfnFLsnAaF86FNbSBSAL33VhM/hOhx4t9o66N37IqSg==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1" + "@webassemblyjs/ast": "1.13.1", + "@webassemblyjs/helper-buffer": "1.13.1", + "@webassemblyjs/wasm-gen": "1.13.1", + "@webassemblyjs/wasm-parser": "1.13.1" } }, "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", - "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.13.1.tgz", + "integrity": "sha512-8SPOcbqSb7vXHG+B0PTsJrvT/HilwV3WkJgxw34lmhWvO+7qM9xBTd9u4dn1Lb86WHpKswT5XwF277uBTHFikg==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-api-error": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" + "@webassemblyjs/ast": "1.13.1", + "@webassemblyjs/helper-api-error": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.12.1", + "@webassemblyjs/ieee754": "1.12.1", + "@webassemblyjs/leb128": "1.12.1", + "@webassemblyjs/utf8": "1.12.1" } }, "node_modules/@webassemblyjs/wast-printer": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", - "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.13.1.tgz", + "integrity": "sha512-q0zIfwpbFvaNkgbSzkZFzLsOs8ixZ5MSdTTMESilSAk1C3P8BKEWfbLEvIqyI/PjNpP9+ZU+/KwgfXx3T7ApKw==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/ast": "1.13.1", "@xtuc/long": "4.2.2" } }, @@ -2862,16 +2884,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", - "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^8" - } - }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -4111,9 +4123,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001673", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001673.tgz", - "integrity": "sha512-WTrjUCSMp3LYX0nE12ECkV0a+e6LC85E0Auz75555/qr78Oc8YWhEPNfDd6SHdtlCMSzqtuXY0uyEMNRcsKpKw==", + "version": "1.0.30001677", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz", + "integrity": "sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==", "dev": true, "funding": [ { @@ -4402,9 +4414,9 @@ "license": "MIT" }, "node_modules/complex.js": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.0.tgz", - "integrity": "sha512-PhTrCnB5SLBicgCtDmKzM0d8YmubCKhpAkrYn7Rk73Pc4m2P61K972QZ+aS3LRETMoBq/ng1UepwC52EN3wC8g==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz", + "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", "license": "MIT", "engines": { "node": "*" @@ -4530,9 +4542,9 @@ } }, "node_modules/core-js": { - "version": "3.38.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.1.tgz", - "integrity": "sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==", + "version": "3.39.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.39.0.tgz", + "integrity": "sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -4542,13 +4554,13 @@ } }, "node_modules/core-js-compat": { - "version": "3.38.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz", - "integrity": "sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==", + "version": "3.39.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.39.0.tgz", + "integrity": "sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==", "dev": true, "license": "MIT", "dependencies": { - "browserslist": "^4.23.3" + "browserslist": "^4.24.2" }, "funding": { "type": "opencollective", @@ -5373,9 +5385,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.47", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.47.tgz", - "integrity": "sha512-zS5Yer0MOYw4rtK2iq43cJagHZ8sXN0jDHDKzB+86gSBSAI4v07S97mcq+Gs2vclAxSh1j7vOAHxSVgduiiuVQ==", + "version": "1.5.52", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz", + "integrity": "sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ==", "dev": true, "license": "ISC" }, @@ -9758,9 +9770,9 @@ } }, "node_modules/mocha": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", - "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", "dev": true, "license": "MIT", "dependencies": { @@ -10648,9 +10660,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", - "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", + "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", "dev": true, "license": "ISC", "engines": { @@ -12804,9 +12816,9 @@ "license": "MIT" }, "node_modules/ts-api-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", - "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.0.tgz", + "integrity": "sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==", "dev": true, "license": "MIT", "engines": { @@ -12897,9 +12909,9 @@ } }, "node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD" }, @@ -13303,9 +13315,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "license": "Apache-2.0", "bin": { @@ -13858,19 +13870,19 @@ "license": "BSD-2-Clause" }, "node_modules/webpack": { - "version": "5.95.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.95.0.tgz", - "integrity": "sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==", + "version": "5.96.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.96.1.tgz", + "integrity": "sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "^1.0.5", + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", diff --git a/package.json b/package.json index 87ad3c75fc..ba60247312 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mathjs", - "version": "13.2.0", + "version": "13.2.1", "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.", "author": "Jos de Jong (https://github.com/josdejong)", "homepage": "https://mathjs.org", @@ -51,7 +51,7 @@ "benchmark": "2.1.4", "c8": "10.1.2", "codecov": "3.8.3", - "core-js": "3.38.1", + "core-js": "3.39.0", "del": "8.0.0", "dtslint": "4.2.1", "eslint": "8.57.0", @@ -77,7 +77,7 @@ "karma-mocha-reporter": "2.2.5", "karma-webpack": "5.0.1", "mkdirp": "3.0.1", - "mocha": "10.7.3", + "mocha": "10.8.2", "mocha-junit-reporter": "2.2.1", "ndarray": "1.0.19", "ndarray-determinant": "1.0.0", @@ -91,8 +91,8 @@ "sinon": "19.0.2", "sylvester": "0.0.21", "ts-node": "10.9.2", - "typescript": "5.6.3", - "webpack": "5.95.0", + "typescript": "5.5.4", + "webpack": "5.96.1", "zeros": "1.0.0" }, "type": "module", diff --git a/src/expression/Parser.js b/src/expression/Parser.js index e39b53d82a..712fc91729 100644 --- a/src/expression/Parser.js +++ b/src/expression/Parser.js @@ -2,9 +2,9 @@ import { factory } from '../utils/factory.js' import { createEmptyMap, toObject } from '../utils/map.js' const name = 'Parser' -const dependencies = ['evaluate'] +const dependencies = ['evaluate', 'parse'] -export const createParserClass = /* #__PURE__ */ factory(name, dependencies, ({ evaluate }) => { +export const createParserClass = /* #__PURE__ */ factory(name, dependencies, ({ evaluate, parse }) => { /** * @constructor Parser * Parser contains methods to evaluate or parse expressions, and has a number @@ -112,12 +112,32 @@ export const createParserClass = /* #__PURE__ */ factory(name, dependencies, ({ return this.scope } + function isValidVariableName (name) { + if (name.length === 0) { return false } + + for (let i = 0; i < name.length; i++) { + const cPrev = name.charAt(i - 1) + const c = name.charAt(i) + const cNext = name.charAt(i + 1) + const valid = parse.isAlpha(c, cPrev, cNext) || (i > 0 && parse.isDigit(c)) + + if (!valid) { + return false + } + } + + return true + } + /** * Set a symbol (a function or variable) by name from the parsers scope. * @param {string} name * @param {* | undefined} value */ Parser.prototype.set = function (name, value) { + if (!isValidVariableName(name)) { + throw new Error(`Invalid variable name: '${name}'. Variable names must follow the specified rules.`) + } this.scope.set(name, value) return value } diff --git a/src/type/matrix/MatrixIndex.js b/src/type/matrix/MatrixIndex.js index 000ce3466c..3f88a0d7d4 100644 --- a/src/type/matrix/MatrixIndex.js +++ b/src/type/matrix/MatrixIndex.js @@ -189,6 +189,10 @@ export const createIndexClass = /* #__PURE__ */ factory(name, dependencies, ({ I * @returns {Range | null} range */ Index.prototype.dimension = function (dim) { + if (typeof dim !== 'number') { + return null + } + return this._dimensions[dim] || null } diff --git a/src/type/resultset/ResultSet.js b/src/type/resultset/ResultSet.js index a56be92e7a..4ce9b8fe0c 100644 --- a/src/type/resultset/ResultSet.js +++ b/src/type/resultset/ResultSet.js @@ -39,7 +39,7 @@ export const createResultSet = /* #__PURE__ */ factory(name, dependencies, () => * @returns {string} string */ ResultSet.prototype.toString = function () { - return '[' + this.entries.join(', ') + ']' + return '[' + this.entries.map(String).join(', ') + ']' } /** diff --git a/src/version.js b/src/version.js index 9ca667ab62..80077287cb 100644 --- a/src/version.js +++ b/src/version.js @@ -1,3 +1,3 @@ -export const version = '13.2.0' +export const version = '13.2.1' // Note: This file is automatically generated when building math.js. // Changes made in this file will be overwritten. diff --git a/test/browser-test-config/lambdatest-hyperexecute-config.yaml b/test/browser-test-config/lambdatest-hyperexecute-config.yaml new file mode 100644 index 0000000000..997e5f4776 --- /dev/null +++ b/test/browser-test-config/lambdatest-hyperexecute-config.yaml @@ -0,0 +1,21 @@ +--- +version: 0.1 +runson: ${matrix.os} # defines the OS to test on + +concurrency: 1 # number of machines to execute the testcases + +matrix: + os: [linux] + +# pre steps sets up the environment for testing +pre: + - npm install + - npm install -g karma karma-jasmine karma-safari-launcher karma-webdriver-launcher karma-mocha karma-webpack mocha + +# Smart cache +cacheKey: '{{ checksum "package-lock.json" }}' +cacheDirectories: + - node_modules + +testSuites: + - karma start test/browser-test-config/lambdatest-karma.js diff --git a/test/browser-test-config/lambdatest-karma.js b/test/browser-test-config/lambdatest-karma.js new file mode 100644 index 0000000000..a1b3c019c9 --- /dev/null +++ b/test/browser-test-config/lambdatest-karma.js @@ -0,0 +1,96 @@ +const baseKarma = require('./base-karma') +const mochaConfig = require('../../.mocharc.json') + +module.exports = function (config) { + const webdriverConfig = { + hostname: 'hub.lambdatest.com', // lambdatest hub address + port: 80 + } + + const baseConfig = baseKarma(config) + + const launcherDefaults = { + base: 'WebDriver', + config: webdriverConfig, + build: 'OSS', + name: 'mathjs', + video: false, // capture video for your test + visual: false, // capture screenshots on each step + network: false, // capture network logs for your test + console: false, // capture browser console logs + terminal: true, + user: process.env.LT_USERNAME, + accessKey: process.env.LT_ACCESS_KEY, + pseudoActivityInterval: 15000 // 5000 ms heartbeat + } + + const customLaunchers = { + chrome_windows: { + ...launcherDefaults, + browserName: 'Chrome', + version: 'latest', + platform: 'Windows 11' + }, + firefox_windows: { + ...launcherDefaults, + browserName: 'Firefox', + version: 'latest', + platform: 'Windows 11' + }, + // safari_mac: { + // ...launcherDefaults, + // browserName: 'Safari', + // version: 'latest', + // platform: 'MacOS Sequoia' + // }, + edge_windows: { + ...launcherDefaults, + browserName: 'MicrosoftEdge', + version: 'latest', + platform: 'Windows 11' + } + // android: { + // ...launcherDefaults, + // browserName: 'Galaxy S10 5G', + // version: '14', + // platform: 'android' + // } + } + + config.set(Object.assign(baseConfig, { + hostname: '127.0.0.1', // hostname, where karma web server will run + port: 9876, + basePath: '../..', + frameworks: ['mocha'], + + client: { + mocha: { + timeout: mochaConfig.timeout + } + }, + files: [ + 'test/browser-test-config/browser-tests.test.js' + ], + + plugins: [ + 'karma-webpack', + 'karma-mocha', + 'karma-webdriver-launcher' + ], + + captureTimeout: 600000, + retryLimit: 1, + browserDisconnectTimeout: 90000, + browserDisconnectTolerance: 1, + browserNoActivityTimeout: 90000, + + concurrency: Infinity, + logLevel: config.LOG_INFO, + + browsers: Object.keys(customLaunchers), + customLaunchers, + + singleRun: true, + autoWatch: false + })) +} diff --git a/test/browser-test-config/lt_karma.js b/test/browser-test-config/lt_karma.js deleted file mode 100644 index e31f70ab55..0000000000 --- a/test/browser-test-config/lt_karma.js +++ /dev/null @@ -1,63 +0,0 @@ -const baseKarma = require('./base-karma') -const mochaConfig = require('../../.mocharc.json') - -module.exports = function (config) { - const webdriverConfig = { - hostname: 'hub.lambdatest.com', // lambdatest hub address - port: 80 - } - - const baseConfig = baseKarma(config) - - config.set(Object.assign(baseConfig, { - hostname: '127.0.0.1', // hostname, where karma web server will run - port: 9876, - basePath: '../..', - frameworks: ['mocha'], - - client: { - mocha: { - timeout: mochaConfig.timeout - } - }, - files: [ - 'test/browser-test-config/browser-tests.test.js' - ], - - plugins: [ - 'karma-webpack', - 'karma-mocha', - 'karma-webdriver-launcher' - ], - - captureTimeout: 600000, - retryLimit: 1, - browserDisconnectTimeout: 90000, - browserDisconnectTolerance: 1, - browserNoActivityTimeout: 90000, - - concurrency: 1, - logLevel: config.LOG_DEBUG, - browsers: ['Windows_Chrome'], - customLaunchers: { - Windows_Chrome: { - base: 'WebDriver', - config: webdriverConfig, - browserName: 'chrome', - version: 'latest', - build: 'OSS', - name: 'Jos MathJs', - video: true, // capture video for your test - visual: true, // capture screenshots on each step - network: true, // capture network logs for your test - console: true, // capture browser console logs - terminal: true, - user: process.env.LT_USERNAME, - accessKey: process.env.LT_ACCESS_KEY, - pseudoActivityInterval: 15000 // 5000 ms heartbeat - } - }, - singleRun: true, - autoWatch: true - })) -} diff --git a/test/unit-tests/expression/Parser.test.js b/test/unit-tests/expression/Parser.test.js index 1916ca9291..bee8932b1a 100644 --- a/test/unit-tests/expression/Parser.test.js +++ b/test/unit-tests/expression/Parser.test.js @@ -128,6 +128,24 @@ describe('parser', function () { assert.strictEqual(parser.evaluate('pi'), Math.PI) }) + it('should validate variable names', function () { + const parser = new Parser() + + // Valid variable names + assert.strictEqual(parser.set('validVar', 42), 42) + assert.strictEqual(parser.evaluate('validVar'), 42) + assert.strictEqual(parser.set('_underscoreVar', 10), 10) + assert.strictEqual(parser.evaluate('_underscoreVar'), 10) + assert.strictEqual(parser.set('var123', 100), 100) + assert.strictEqual(parser.evaluate('var123'), 100) + + // Invalid variable names + assert.throws(() => parser.set('123var', 5), /Invalid variable name/) + assert.throws(() => parser.set('var-with-hyphen', 5), /Invalid variable name/) + assert.throws(() => parser.set('var with space', 5), /Invalid variable name/) + assert.throws(() => parser.set('@specialChar', 5), /Invalid variable name/) + }) + describe('security', function () { it('should return undefined when accessing what appears to be inherited properties', function () { try { diff --git a/test/unit-tests/expression/security.test.js b/test/unit-tests/expression/security.test.js index 141b78c178..6ea71ffce4 100644 --- a/test/unit-tests/expression/security.test.js +++ b/test/unit-tests/expression/security.test.js @@ -217,6 +217,10 @@ describe('security', function () { }, /TypeError: Unexpected type of argument in function subset \(expected: Index, actual: Object, index: 1\)/) }) + it('should not allow accessing proto via dimension', function () { + assert.strictEqual(math.evaluate('a=index([0,1]);b=a.dimension("__proto__");b').toString(), '[null]') + }) + it('should not allow using restricted properties via subset (2)', function () { assert.throws(function () { math.evaluate("scope={}; setter = evaluate(\"f(obj, name, newValue, assign) = (obj[name] = newValue)\", scope); o = parse(\"1\"); setter(o, \"value\", \"evaluate\", subset); scope.obj.compile().evaluate()(\"console.log('hacked...')\")")