diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a6d9bba46..6f4d11d89c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -118,3 +118,8 @@ jobs: with: name: cypress-screenshots path: cypress/screenshots + - uses: actions/upload-artifact@v4 + if: success() && ${{ matrix.react == '18' }} + with: + name: coverage + path: cypress/screenshots diff --git a/.gitignore b/.gitignore index 0de0861994..a116be6f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ storybook-static # misc .DS_Store .eslintcache +.swc npm-debug.log* yarn-debug.log* diff --git a/cypress.config.ts b/cypress.config.ts index 93f9df8619..0244c8e5bb 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,8 +1,8 @@ +import installCoverageTask from "@cypress/code-coverage/task"; // @ts-ignore import { defineConfig } from "cypress"; import { devServer } from "cypress-rspack-dev-server"; import { merge } from "webpack-merge"; -// import installCoverageTask from "@cypress/code-coverage/task"; export default defineConfig({ viewportWidth: 1280, @@ -10,7 +10,7 @@ export default defineConfig({ video: false, component: { setupNodeEvents(on, config) { - // installCoverageTask(on, config); + installCoverageTask(on, config); //Setting up a log task to allow logging to the console during an axe test because console.log() does not work directly in a test on("task", { log(message: string) { diff --git a/package.json b/package.json index c3fa117800..1572c8bef9 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "copy:icon:css": "yarn workspace @salt-ds/icons copy:css", "copy:countries:css": "yarn workspace @salt-ds/countries copy:css", "test": "vitest", - "test:components": "CYPRESS_NO_COMMAND_LOG=1 cypress run --component --browser chrome", + "test:components": "cypress run --component --browser chrome", "test:components:local": "cypress open --component --browser electron", "prettier": "prettier --write .", "prettier:ci": "prettier --check .", @@ -81,7 +81,6 @@ "ag-grid-enterprise": "^31.3.4", "ag-grid-react": "^31.3.4", "axe-core": "^4.9.0", - "babel-loader": "^9.1.3", "chromatic": "^11.10.1", "ci-info": "^4.0.0", "clsx": "^2.0.0", @@ -104,6 +103,7 @@ "storybook": "^8.3.0", "style-loader": "^4.0.0", "stylelint": "^16.0.0", + "swc-plugin-coverage-instrument": "^0.0.25", "typescript": "4.6.4", "vite": "^5.0.0", "vite-plugin-istanbul": "^6.0.0", diff --git a/rspack.config.ts b/rspack.config.ts index 93131624e5..c76bdec678 100644 --- a/rspack.config.ts +++ b/rspack.config.ts @@ -16,16 +16,15 @@ export default defineConfig({ test: /\.css$/, use: ["style-loader", "css-loader", "postcss-loader"], }, - { - test: /packages\/.*\/src\/.*\.[tj]sx?$/, - use: ["babel-loader"], - }, { test: /\.(j|t)s$/, exclude: [/[\\/]node_modules[\\/]/], loader: "builtin:swc-loader", options: { jsc: { + experimental: { + plugins: [["swc-plugin-coverage-instrument", {}]], + }, parser: { syntax: "typescript", }, @@ -46,6 +45,9 @@ export default defineConfig({ exclude: [/[\\/]node_modules[\\/]/], options: { jsc: { + experimental: { + plugins: [["swc-plugin-coverage-instrument", {}]], + }, parser: { syntax: "typescript", tsx: true, diff --git a/yarn.lock b/yarn.lock index 4eda309bf9..c6416bbc41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3752,7 +3752,6 @@ __metadata: ag-grid-enterprise: "npm:^31.3.4" ag-grid-react: "npm:^31.3.4" axe-core: "npm:^4.9.0" - babel-loader: "npm:^9.1.3" browserslist-to-esbuild: "npm:^2.1.1" chromatic: "npm:^11.10.1" ci-info: "npm:^4.0.0" @@ -3781,6 +3780,7 @@ __metadata: storybook: "npm:^8.3.0" style-loader: "npm:^4.0.0" stylelint: "npm:^16.0.0" + swc-plugin-coverage-instrument: "npm:^0.0.25" typescript: "npm:4.6.4" vite: "npm:^5.0.0" vite-plugin-istanbul: "npm:^6.0.0" @@ -6895,19 +6895,6 @@ __metadata: languageName: node linkType: hard -"babel-loader@npm:^9.1.3": - version: 9.1.3 - resolution: "babel-loader@npm:9.1.3" - dependencies: - find-cache-dir: "npm:^4.0.0" - schema-utils: "npm:^4.0.0" - peerDependencies: - "@babel/core": ^7.12.0 - webpack: ">=5" - checksum: 10/7086e678273b5d1261141dca84ed784caab9f7921c8c24d7278c8ee3088235a9a9fd85caac9f0fa687336cb3c27248ca22dbf431469769b1b995d55aec606992 - languageName: node - linkType: hard - "bail@npm:^2.0.0": version: 2.0.2 resolution: "bail@npm:2.0.2" @@ -7760,13 +7747,6 @@ __metadata: languageName: node linkType: hard -"common-path-prefix@npm:^3.0.0": - version: 3.0.0 - resolution: "common-path-prefix@npm:3.0.0" - checksum: 10/09c180e8d8495d42990d617f4d4b7522b5da20f6b236afe310192d401d1da8147a7835ae1ea37797ba0c2238ef3d06f3492151591451df34539fdb4b2630f2b3 - languageName: node - linkType: hard - "common-tags@npm:^1.8.0": version: 1.8.2 resolution: "common-tags@npm:1.8.2" @@ -10167,16 +10147,6 @@ __metadata: languageName: node linkType: hard -"find-cache-dir@npm:^4.0.0": - version: 4.0.0 - resolution: "find-cache-dir@npm:4.0.0" - dependencies: - common-path-prefix: "npm:^3.0.0" - pkg-dir: "npm:^7.0.0" - checksum: 10/52a456a80deeb27daa3af6e06059b63bdb9cc4af4d845fc6d6229887e505ba913cd56000349caa60bc3aa59dacdb5b4c37903d4ba34c75102d83cab330b70d2f - languageName: node - linkType: hard - "find-my-way@npm:^7.7.0": version: 7.7.0 resolution: "find-my-way@npm:7.7.0" @@ -10188,7 +10158,7 @@ __metadata: languageName: node linkType: hard -"find-up@npm:6.3.0, find-up@npm:^6.3.0": +"find-up@npm:6.3.0": version: 6.3.0 resolution: "find-up@npm:6.3.0" dependencies: @@ -15276,14 +15246,7 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^1.0.0, picocolors@npm:^1.0.1, picocolors@npm:^1.1.0": - version: 1.1.0 - resolution: "picocolors@npm:1.1.0" - checksum: 10/a2ad60d94d185c30f2a140b19c512547713fb89b920d32cc6cf658fa786d63a37ba7b8451872c3d9fc34883971fb6e5878e07a20b60506e0bb2554dce9169ccb - languageName: node - linkType: hard - -"picocolors@npm:^1.1.1": +"picocolors@npm:^1.0.0, picocolors@npm:^1.0.1, picocolors@npm:^1.1.1": version: 1.1.1 resolution: "picocolors@npm:1.1.1" checksum: 10/e1cf46bf84886c79055fdfa9dcb3e4711ad259949e3565154b004b260cd356c5d54b31a1437ce9782624bf766272fe6b0154f5f0c744fb7af5d454d2b60db045 @@ -15379,15 +15342,6 @@ __metadata: languageName: node linkType: hard -"pkg-dir@npm:^7.0.0": - version: 7.0.0 - resolution: "pkg-dir@npm:7.0.0" - dependencies: - find-up: "npm:^6.3.0" - checksum: 10/94298b20a446bfbbd66604474de8a0cdd3b8d251225170970f15d9646f633e056c80520dd5b4c1d1050c9fed8f6a9e5054b141c93806439452efe72e57562c03 - languageName: node - linkType: hard - "pluralize@npm:^8.0.0": version: 8.0.0 resolution: "pluralize@npm:8.0.0" @@ -15587,16 +15541,7 @@ __metadata: languageName: node linkType: hard -"postcss-modules-extract-imports@npm:^3.0.0": - version: 3.0.0 - resolution: "postcss-modules-extract-imports@npm:3.0.0" - peerDependencies: - postcss: ^8.1.0 - checksum: 10/8d68bb735cef4d43f9cdc1053581e6c1c864860b77fcfb670372b39c5feeee018dc5ddb2be4b07fef9bcd601edded4262418bbaeaf1bd4af744446300cebe358 - languageName: node - linkType: hard - -"postcss-modules-extract-imports@npm:^3.1.0": +"postcss-modules-extract-imports@npm:^3.0.0, postcss-modules-extract-imports@npm:^3.1.0": version: 3.1.0 resolution: "postcss-modules-extract-imports@npm:3.1.0" peerDependencies: @@ -15605,20 +15550,7 @@ __metadata: languageName: node linkType: hard -"postcss-modules-local-by-default@npm:^4.0.0": - version: 4.0.0 - resolution: "postcss-modules-local-by-default@npm:4.0.0" - dependencies: - icss-utils: "npm:^5.0.0" - postcss-selector-parser: "npm:^6.0.2" - postcss-value-parser: "npm:^4.1.0" - peerDependencies: - postcss: ^8.1.0 - checksum: 10/94670d17bdc545ef4054724224597cb321fdf6086de56ecf6b7f809d0fb6f63d493badd5856cb05122bbc81a5a6684b4e15bc7686004ac3097c0ea916f57dad2 - languageName: node - linkType: hard - -"postcss-modules-local-by-default@npm:^4.0.5": +"postcss-modules-local-by-default@npm:^4.0.0, postcss-modules-local-by-default@npm:^4.0.5": version: 4.1.0 resolution: "postcss-modules-local-by-default@npm:4.1.0" dependencies: @@ -15631,18 +15563,7 @@ __metadata: languageName: node linkType: hard -"postcss-modules-scope@npm:^3.0.0": - version: 3.0.0 - resolution: "postcss-modules-scope@npm:3.0.0" - dependencies: - postcss-selector-parser: "npm:^6.0.4" - peerDependencies: - postcss: ^8.1.0 - checksum: 10/cc36b8111c6160a1c21ca0e82de9daf0147be95f3b5403aedd83bcaee44ee425cb62b77f677fc53d0c8d51f7981018c1c8f0a4ad3d6f0138b09326ac48c2b297 - languageName: node - linkType: hard - -"postcss-modules-scope@npm:^3.2.0": +"postcss-modules-scope@npm:^3.0.0, postcss-modules-scope@npm:^3.2.0": version: 3.2.1 resolution: "postcss-modules-scope@npm:3.2.1" dependencies: @@ -15832,7 +15753,7 @@ __metadata: languageName: node linkType: hard -"postcss-selector-parser@npm:^6.0.13, postcss-selector-parser@npm:^6.0.2, postcss-selector-parser@npm:^6.0.4, postcss-selector-parser@npm:^6.0.5, postcss-selector-parser@npm:^6.0.9": +"postcss-selector-parser@npm:^6.0.13, postcss-selector-parser@npm:^6.0.4, postcss-selector-parser@npm:^6.0.5, postcss-selector-parser@npm:^6.0.9": version: 6.0.13 resolution: "postcss-selector-parser@npm:6.0.13" dependencies: @@ -15893,18 +15814,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.32, postcss@npm:^8.4.43": - version: 8.4.47 - resolution: "postcss@npm:8.4.47" - dependencies: - nanoid: "npm:^3.3.7" - picocolors: "npm:^1.1.0" - source-map-js: "npm:^1.2.1" - checksum: 10/f2b50ba9b6fcb795232b6bb20de7cdc538c0025989a8ed9c4438d1960196ba3b7eaff41fdb1a5c701b3504651ea87aeb685577707f0ae4d6ce6f3eae5df79a81 - languageName: node - linkType: hard - -"postcss@npm:^8.4.33": +"postcss@npm:^8.4.32, postcss@npm:^8.4.33, postcss@npm:^8.4.43": version: 8.4.49 resolution: "postcss@npm:8.4.49" dependencies: @@ -18590,6 +18500,13 @@ __metadata: languageName: node linkType: hard +"swc-plugin-coverage-instrument@npm:^0.0.25": + version: 0.0.25 + resolution: "swc-plugin-coverage-instrument@npm:0.0.25" + checksum: 10/110cf8074a2932c9cc370dbd833db4b71dca5a386ab13ca1116811fcf3be5498f98ab755cdf7395cf19cdd0da711119ac3edc9ab3c8bc26e50ca60ca07ae834d + languageName: node + linkType: hard + "swr@npm:^2.1.2": version: 2.1.5 resolution: "swr@npm:2.1.5"