PromucFlow_constructor/app/client/jest.config.js

119 lines
4.3 KiB
JavaScript
Raw Permalink Normal View History

function parseConfig() {
return "";
}
const LOG_LEVELS = ["debug", "error"];
const CONFIG_LOG_LEVEL_INDEX = 1;
module.exports = {
setupFiles: [
"jest-canvas-mock",
"<rootDir>/test/__mocks__/reactMarkdown.tsx",
],
roots: ["<rootDir>/src"],
transform: {
"^.+\\.(png|js|ts|tsx)$": [
"ts-jest",
{
isolatedModules: true,
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: "node_modules/ts-jest-mock-import-meta",
chore: Split derived.test.js to separate files. (#38162) ## Description This PR started with this goal: - Deleted the unreadable `derived.test.js` (4668 lines) file and split each suite to its file. - Moved all `derived.js` related specs in widget folder to __tests__ folder Later we found that `testRegex` in `jest.config` will treat anything inside `__tests__` as runnable, so we modify this rule and are moving to a consistent naming for our unit tests(any file ending with `.test.` or `.spec.` This refactor aims to improve maintainability and ensure that the table widget's derived properties are thoroughly tested. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD b3168bb1a6d3070a910972d1d9a78d61a3aaee91 yet > <hr>Tue, 17 Dec 2024 10:20:54 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Expanded properties for table widget configuration. - Introduced sample data constants for column schemas and processed table data. - **Bug Fixes** - Improved validation tests for editable cells and row selection functions. - **Tests** - Added comprehensive test suites for various table widget functionalities, including filtering, sorting, and row selection. - Introduced tests for handling HTML content within table columns. - Added tests for new functions related to row updates and indices. - Enhanced test coverage for existing utility functions and table properties. - **Chores** - Updated import paths to reflect a new directory structure across various test files. - Modified Jest configuration for improved readability and regex adjustments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-17 12:46:27 +00:00
options: {
metaObjectReplacement: { url: "https://www.url.com" },
},
},
],
},
chore: Split derived.test.js to separate files. (#38162) ## Description This PR started with this goal: - Deleted the unreadable `derived.test.js` (4668 lines) file and split each suite to its file. - Moved all `derived.js` related specs in widget folder to __tests__ folder Later we found that `testRegex` in `jest.config` will treat anything inside `__tests__` as runnable, so we modify this rule and are moving to a consistent naming for our unit tests(any file ending with `.test.` or `.spec.` This refactor aims to improve maintainability and ensure that the table widget's derived properties are thoroughly tested. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD b3168bb1a6d3070a910972d1d9a78d61a3aaee91 yet > <hr>Tue, 17 Dec 2024 10:20:54 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Expanded properties for table widget configuration. - Introduced sample data constants for column schemas and processed table data. - **Bug Fixes** - Improved validation tests for editable cells and row selection functions. - **Tests** - Added comprehensive test suites for various table widget functionalities, including filtering, sorting, and row selection. - Introduced tests for handling HTML content within table columns. - Added tests for new functions related to row updates and indices. - Enhanced test coverage for existing utility functions and table properties. - **Chores** - Updated import paths to reflect a new directory structure across various test files. - Modified Jest configuration for improved readability and regex adjustments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-17 12:46:27 +00:00
},
],
},
testEnvironment: "jsdom",
testTimeout: 9000,
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
chore: Split derived.test.js to separate files. (#38162) ## Description This PR started with this goal: - Deleted the unreadable `derived.test.js` (4668 lines) file and split each suite to its file. - Moved all `derived.js` related specs in widget folder to __tests__ folder Later we found that `testRegex` in `jest.config` will treat anything inside `__tests__` as runnable, so we modify this rule and are moving to a consistent naming for our unit tests(any file ending with `.test.` or `.spec.` This refactor aims to improve maintainability and ensure that the table widget's derived properties are thoroughly tested. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD b3168bb1a6d3070a910972d1d9a78d61a3aaee91 yet > <hr>Tue, 17 Dec 2024 10:20:54 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Expanded properties for table widget configuration. - Introduced sample data constants for column schemas and processed table data. - **Bug Fixes** - Improved validation tests for editable cells and row selection functions. - **Tests** - Added comprehensive test suites for various table widget functionalities, including filtering, sorting, and row selection. - Introduced tests for handling HTML content within table columns. - Added tests for new functions related to row updates and indices. - Enhanced test coverage for existing utility functions and table properties. - **Chores** - Updated import paths to reflect a new directory structure across various test files. - Modified Jest configuration for improved readability and regex adjustments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-17 12:46:27 +00:00
testRegex: "\\.(test|spec)\\.(tsx|ts|js)?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", "css"],
moduleDirectories: ["node_modules", "src", "test"],
transformIgnorePatterns: [
fix: Upgrade packages (#40935) ## Description - Upgrades packages reported by Dependabot: - `nanoid` - `brace-expansion` - `webpack-dev-server` - `path-to-regexp` - `vite` - `http-proxy-middleware` Fixes the following issues - https://github.com/appsmithorg/appsmith/security/dependabot/416 - https://github.com/appsmithorg/appsmith/security/dependabot/406 - https://github.com/appsmithorg/appsmith/security/dependabot/408 - https://github.com/appsmithorg/appsmith/security/dependabot/332 - https://github.com/appsmithorg/appsmith/security/dependabot/361 - https://github.com/appsmithorg/appsmith/security/dependabot/415 - https://github.com/appsmithorg/appsmith/security/dependabot/414 - https://github.com/appsmithorg/appsmith/security/dependabot/413 - https://github.com/appsmithorg/appsmith/security/dependabot/418 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/15630439422> > Commit: 2b6f4a45af4410f079b96c4c06606f33af5e7b99 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15630439422&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Fri, 13 Jun 2025 10:49:32 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved development server configuration for enhanced compatibility and middleware management. - **Bug Fixes** - Updated unique key generation to ensure consistency and reliability across the application. - **Chores** - Upgraded and adjusted dependencies for better stability and security. - Refined package resolution to address version conflicts. - **Style** - Standardized string formatting and code styling in development scripts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-16 06:42:55 +00:00
"<rootDir>/node_modules/(?!codemirror|konva|react-dnd|dnd-core|@babel|(@blueprintjs)|@github|lodash-es|@draft-js-plugins|react-documents|linkedom|assert-never|axios|usehooks-ts|date-fns|nanoid)",
],
moduleNameMapper: {
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js",
"\\.svg$": "<rootDir>/test/__mocks__/svgMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|txt)$":
"<rootDir>/test/__mocks__/fileMock.js",
"^worker-loader!": "<rootDir>/test/__mocks__/workerMock.js",
"^!!raw-loader!": "<rootDir>/test/__mocks__/derivedMock.js",
"test/(.*)": "<rootDir>/test/$1",
"@appsmith/ads-old": "<rootDir>/node_modules/@appsmith/ads-old",
feat: [epic] appsmith design system version 2 deduplication (#22030) ## Description ### Fixes - [x] https://github.com/appsmithorg/appsmith/issues/19383 - [x] https://github.com/appsmithorg/appsmith/issues/19384 - [x] https://github.com/appsmithorg/appsmith/issues/19385 - [x] https://github.com/appsmithorg/appsmith/issues/19386 - [x] https://github.com/appsmithorg/appsmith/issues/19387 - [x] https://github.com/appsmithorg/appsmith/issues/19388 - [x] https://github.com/appsmithorg/appsmith/issues/19389 - [x] https://github.com/appsmithorg/appsmith/issues/19390 - [x] https://github.com/appsmithorg/appsmith/issues/19391 - [x] https://github.com/appsmithorg/appsmith/issues/19392 - [x] https://github.com/appsmithorg/appsmith/issues/19393 - [x] https://github.com/appsmithorg/appsmith/issues/19394 - [x] https://github.com/appsmithorg/appsmith/issues/19395 - [x] https://github.com/appsmithorg/appsmith/issues/19396 - [x] https://github.com/appsmithorg/appsmith/issues/19397 - [x] https://github.com/appsmithorg/appsmith/issues/19398 - [x] https://github.com/appsmithorg/appsmith/issues/19399 - [x] https://github.com/appsmithorg/appsmith/issues/19400 - [x] https://github.com/appsmithorg/appsmith/issues/19401 - [x] https://github.com/appsmithorg/appsmith/issues/19402 - [x] https://github.com/appsmithorg/appsmith/issues/19403 - [x] https://github.com/appsmithorg/appsmith/issues/19404 - [x] https://github.com/appsmithorg/appsmith/issues/19405 - [x] https://github.com/appsmithorg/appsmith/issues/19406 - [x] https://github.com/appsmithorg/appsmith/issues/19407 - [x] https://github.com/appsmithorg/appsmith/issues/19408 - [x] https://github.com/appsmithorg/appsmith/issues/19409 Fixes # (issue) > if no issue exists, please create an issue and ask the maintainers about this first Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video ## Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Ankita Kinger <ankita@appsmith.com> Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com> Co-authored-by: Tanvi Bhakta <tanvi@appsmith.com> Co-authored-by: Arsalan <arsalanyaldram0211@outlook.com> Co-authored-by: Aman Agarwal <aman@appsmith.com> Co-authored-by: Rohit Agarwal <rohit_agarwal@live.in> Co-authored-by: Nilesh Sarupriya <nilesh@appsmith.com> Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com> Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local> Co-authored-by: Vijetha-Kaja <vijetha@appsmith.com> Co-authored-by: Parthvi <80334441+Parthvi12@users.noreply.github.com> Co-authored-by: Apple <nandan@thinkify.io> Co-authored-by: Saroj <43822041+sarojsarab@users.noreply.github.com> Co-authored-by: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Vijetha-Kaja <119562824+Vijetha-Kaja@users.noreply.github.com> Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-05-19 18:37:06 +00:00
"@design-system/widgets-old":
"<rootDir>/node_modules/@design-system/widgets-old",
"^proxy-memoize$": "<rootDir>/node_modules/proxy-memoize/dist/wrapper.cjs",
// @blueprintjs packages need to be resolved to the `esnext` directory. The default `esm` directory
// contains sources that are transpiled to ES5. As Jest does not transpile our sources to ES5,
// this results in mixing ES6 and ES5 code and causes errors like:
// Class constructor GlobalHotKeys cannot be invoked without 'new'
// Note: this isnt issue in the live app because we transpile *everything* down to ES5 there.
"^@blueprintjs/core$":
"<rootDir>/node_modules/@blueprintjs/core/lib/esnext",
"^@blueprintjs/datetime$":
"<rootDir>/node_modules/@blueprintjs/datetime/lib/esnext",
"^@blueprintjs/icons$":
"<rootDir>/node_modules/@blueprintjs/icons/lib/esnext",
"^@blueprintjs/popover2$":
"<rootDir>/node_modules/@blueprintjs/popover2/lib/esnext",
"^@blueprintjs/select$":
"<rootDir>/node_modules/@blueprintjs/select/lib/esnext",
"@appsmith/ads": "<rootDir>/node_modules/@appsmith/ads",
fix: remove dependency on `canvas` in `package.json` (#28273) ## Description - We added the `canvas` dependency in `package.json` to enable jest tests to work - As an alternative, we're mocking the `canvas` for jest tests #### PR fixes following issue(s) Fixes # (issue number) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - This change works if existing tests pass - [ ] Cypress - This change works if existing tests pass ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-10-23 13:18:33 +00:00
"^canvas$": "jest-canvas-mock",
chore: Split derived.test.js to separate files. (#38162) ## Description This PR started with this goal: - Deleted the unreadable `derived.test.js` (4668 lines) file and split each suite to its file. - Moved all `derived.js` related specs in widget folder to __tests__ folder Later we found that `testRegex` in `jest.config` will treat anything inside `__tests__` as runnable, so we modify this rule and are moving to a consistent naming for our unit tests(any file ending with `.test.` or `.spec.` This refactor aims to improve maintainability and ensure that the table widget's derived properties are thoroughly tested. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD b3168bb1a6d3070a910972d1d9a78d61a3aaee91 yet > <hr>Tue, 17 Dec 2024 10:20:54 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Expanded properties for table widget configuration. - Introduced sample data constants for column schemas and processed table data. - **Bug Fixes** - Improved validation tests for editable cells and row selection functions. - **Tests** - Added comprehensive test suites for various table widget functionalities, including filtering, sorting, and row selection. - Introduced tests for handling HTML content within table columns. - Added tests for new functions related to row updates and indices. - Enhanced test coverage for existing utility functions and table properties. - **Chores** - Updated import paths to reflect a new directory structure across various test files. - Modified Jest configuration for improved readability and regex adjustments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-17 12:46:27 +00:00
"^entities/(.*)$": "<rootDir>/src/entities/$1", // Match 'entities/*'
},
globals: {
APPSMITH_FEATURE_CONFIGS: {
sentry: {
dsn: parseConfig("__APPSMITH_SENTRY_DSN__"),
release: parseConfig("__APPSMITH_SENTRY_RELEASE__"),
environment: parseConfig("__APPSMITH_SENTRY_ENVIRONMENT__"),
},
smartLook: {
id: parseConfig("__APPSMITH_SMART_LOOK_ID__"),
},
segment: {
apiKey: parseConfig("__APPSMITH_SEGMENT_KEY__"),
ceKey: parseConfig("__APPSMITH_SEGMENT_CE_KEY__"),
},
observability: {
deploymentName: "jest-run",
serviceInstanceId: "appsmith-0",
chore: add grafana faro sdk (CE) (#38301) ## Description - Remove new relic browser agent - Add faro sdk to capture frontend perf metrics and traces. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12490844984> > Commit: c9d4264027467bf33e1de519eb69c7762b6e7f75 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12490844984&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 25 Dec 2024 09:33:26 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced new environment variable `APPSMITH_HOSTNAME` for dynamic hostname configuration in HTML files. - Enhanced telemetry capabilities with new imports and updated types for better observability. - Added `tracingUrl` under the observability section in configuration files for improved telemetry tracking. - **Bug Fixes** - Adjusted telemetry data handling to utilize new `Attributes` type for improved consistency. - **Documentation** - Updated import paths for various telemetry-related components to reflect new module organization. - **Chores** - Removed deprecated telemetry configurations and streamlined build processes. - Updated Nginx configuration to reflect new telemetry parameters. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-26 05:07:41 +00:00
tracingUrl: "",
},
fusioncharts: {
licenseKey: parseConfig("__APPSMITH_FUSIONCHARTS_LICENSE_KEY__"),
},
mixpanel: {
enabled: parseConfig("__APPSMITH_SEGMENT_KEY__"),
apiKey: parseConfig("__APPSMITH_MIXPANEL_KEY__"),
},
logLevel:
CONFIG_LOG_LEVEL_INDEX > -1
? LOG_LEVELS[CONFIG_LOG_LEVEL_INDEX]
: LOG_LEVELS[1],
cloudHosting: "CLOUD_HOSTING",
appVersion: {
id: parseConfig("__APPSMITH_VERSION_ID__"),
sha: parseConfig("__APPSMITH_VERSION_SHA__"),
releaseDate: parseConfig("__APPSMITH_VERSION_RELEASE_DATE__"),
},
intercomAppID: "APP_ID",
mailEnabled: parseConfig("__APPSMITH_MAIL_ENABLED__"),
disableIframeWidgetSandbox: parseConfig(
"__APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX__",
),
},
},
};