SIGN IN SIGN UP
apache / spark UNCLAIMED

Apache Spark - A unified analytics engine for large-scale data processing

43057 0 45 Scala
[SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code ### What changes were proposed in this pull request? Create an ui-test module with Jest to test ui javascript code. The tests below are also shipped with this PR for testing the functionality of this PR. ``` ui-test/tests/flamegraph.test.js ui-test/tests/utils.test.js ``` Followups will focus on improving the test coverage of the rest of the javascript files. Jest: https://jestjs.io/ ### Why are the changes needed? - Developing and verifying the javascript is hard for developers while creating PRs, mainly by building distribution and running. - Maintaining the UI javascript files is also difficult for maintainers because of the lack of CI workflows. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? New UI GitHub action workflow. Passed with ```log Run cd ui-test cd ui-test npm install --save-dev node --experimental-vm-modules node_modules/.bin/jest shell: /usr/bin/bash -e {0} added 343 packages, and audited 344 packages in 3s 34 packages are looking for funding run `npm fund` for details found 0 vulnerabilities (node:1995) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:1996) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) PASS tests/utils.test.js PASS tests/flamegraph.test.js Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 2.705 s Ran all test suites. ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes #43903 from yaooqinn/SPARK-46003. Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
2023-11-28 18:12:22 -08:00
{
"name": "ui-test",
"license": "Apache License 2.0",
"type": "module",
[SPARK-55522][WEBUI] Allow inline scripts, event handlers and styles in Spark UI with Content-Security-Policy ### What changes were proposed in this pull request? This PR fixes an issue that the WebUI has been broken since Content-Security-Policy was introduced in #54028 This is one example. <img width="1720" height="850" alt="broken-ui" src="https://github.com/user-attachments/assets/2ac1f328-c5d9-487e-a2e3-e216612a50f0" /> The reason is that inline scripts, event handlers and styles are not allowed. To allow inline scripts, this PR adds `nonce`. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce#using_nonce_to_allowlist_a_script_element This workaround cannot be applied to inline styles so this PR applies `unsafe-inline`. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#unsafe-inline I think this compromise is OK because inline scripts are protected by nonce. Nonce cannot be applied to inline handlers too. So this PR rewrites them. ### Why are the changes needed? Bug fix. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? New tests added mainly for nonce. I also confirmed that UI components are correctly rendered, no error message on browser-embedded developer console and mouse actions correctly works with simple RDD jobs and queries. ### Was this patch authored or co-authored using generative AI tooling? Kiro CLI / Opus 4.6 Closes #54315 from sarutak/fix-content-security-policy-for-inline-js2. Authored-by: Kousuke Saruta <sarutak@amazon.co.jp> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2026-02-14 00:55:20 -08:00
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
},
[SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code ### What changes were proposed in this pull request? Create an ui-test module with Jest to test ui javascript code. The tests below are also shipped with this PR for testing the functionality of this PR. ``` ui-test/tests/flamegraph.test.js ui-test/tests/utils.test.js ``` Followups will focus on improving the test coverage of the rest of the javascript files. Jest: https://jestjs.io/ ### Why are the changes needed? - Developing and verifying the javascript is hard for developers while creating PRs, mainly by building distribution and running. - Maintaining the UI javascript files is also difficult for maintainers because of the lack of CI workflows. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? New UI GitHub action workflow. Passed with ```log Run cd ui-test cd ui-test npm install --save-dev node --experimental-vm-modules node_modules/.bin/jest shell: /usr/bin/bash -e {0} added 343 packages, and audited 344 packages in 3s 34 packages are looking for funding run `npm fund` for details found 0 vulnerabilities (node:1995) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:1996) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) PASS tests/utils.test.js PASS tests/flamegraph.test.js Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 2.705 s Ran all test suites. ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes #43903 from yaooqinn/SPARK-46003. Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
2023-11-28 18:12:22 -08:00
"devDependencies": {
"glob": "^13.0.3",
"jest": "^30.0.0",
"jest-environment-jsdom": "^30.0.0",
[SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code ### What changes were proposed in this pull request? Create an ui-test module with Jest to test ui javascript code. The tests below are also shipped with this PR for testing the functionality of this PR. ``` ui-test/tests/flamegraph.test.js ui-test/tests/utils.test.js ``` Followups will focus on improving the test coverage of the rest of the javascript files. Jest: https://jestjs.io/ ### Why are the changes needed? - Developing and verifying the javascript is hard for developers while creating PRs, mainly by building distribution and running. - Maintaining the UI javascript files is also difficult for maintainers because of the lack of CI workflows. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? New UI GitHub action workflow. Passed with ```log Run cd ui-test cd ui-test npm install --save-dev node --experimental-vm-modules node_modules/.bin/jest shell: /usr/bin/bash -e {0} added 343 packages, and audited 344 packages in 3s 34 packages are looking for funding run `npm fund` for details found 0 vulnerabilities (node:1995) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:1996) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) PASS tests/utils.test.js PASS tests/flamegraph.test.js Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 2.705 s Ran all test suites. ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes #43903 from yaooqinn/SPARK-46003. Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
2023-11-28 18:12:22 -08:00
"jquery": "^3.7.1"
},
"jest": {
[SPARK-55522][WEBUI] Allow inline scripts, event handlers and styles in Spark UI with Content-Security-Policy ### What changes were proposed in this pull request? This PR fixes an issue that the WebUI has been broken since Content-Security-Policy was introduced in #54028 This is one example. <img width="1720" height="850" alt="broken-ui" src="https://github.com/user-attachments/assets/2ac1f328-c5d9-487e-a2e3-e216612a50f0" /> The reason is that inline scripts, event handlers and styles are not allowed. To allow inline scripts, this PR adds `nonce`. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce#using_nonce_to_allowlist_a_script_element This workaround cannot be applied to inline styles so this PR applies `unsafe-inline`. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#unsafe-inline I think this compromise is OK because inline scripts are protected by nonce. Nonce cannot be applied to inline handlers too. So this PR rewrites them. ### Why are the changes needed? Bug fix. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? New tests added mainly for nonce. I also confirmed that UI components are correctly rendered, no error message on browser-embedded developer console and mouse actions correctly works with simple RDD jobs and queries. ### Was this patch authored or co-authored using generative AI tooling? Kiro CLI / Opus 4.6 Closes #54315 from sarutak/fix-content-security-policy-for-inline-js2. Authored-by: Kousuke Saruta <sarutak@amazon.co.jp> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2026-02-14 00:55:20 -08:00
"testEnvironment": "jsdom",
"transform": {}
[SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code ### What changes were proposed in this pull request? Create an ui-test module with Jest to test ui javascript code. The tests below are also shipped with this PR for testing the functionality of this PR. ``` ui-test/tests/flamegraph.test.js ui-test/tests/utils.test.js ``` Followups will focus on improving the test coverage of the rest of the javascript files. Jest: https://jestjs.io/ ### Why are the changes needed? - Developing and verifying the javascript is hard for developers while creating PRs, mainly by building distribution and running. - Maintaining the UI javascript files is also difficult for maintainers because of the lack of CI workflows. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? New UI GitHub action workflow. Passed with ```log Run cd ui-test cd ui-test npm install --save-dev node --experimental-vm-modules node_modules/.bin/jest shell: /usr/bin/bash -e {0} added 343 packages, and audited 344 packages in 3s 34 packages are looking for funding run `npm fund` for details found 0 vulnerabilities (node:1995) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:1996) ExperimentalWarning: VM Modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) PASS tests/utils.test.js PASS tests/flamegraph.test.js Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 2.705 s Ran all test suites. ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes #43903 from yaooqinn/SPARK-46003. Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
2023-11-28 18:12:22 -08:00
}
}