Skip to content

Commit

Permalink
chore(deps): updates all dependencies (#471)
Browse files Browse the repository at this point in the history
* chore(deps): updates all dependencies

Updates all dependencies.

Removes `data-v` attributes from snapshots to avoid minor/patch releases of Kongponents to breaking our tests solely on account of all the `data-v` attributes changing.

Adds workaround plugin for Vite issue vitejs/vite#2415.

* refactor: removes all data-v-* attributes

* refactor: ditch tableDataUtils

Removes the `getTableData` function and its related utilities in favor of direct API calls in components which allows for more precise type inference.

Signed-off-by: Philipp Rudloff <[email protected]>
  • Loading branch information
Philipp Rudloff authored Nov 29, 2022
1 parent 83ab8eb commit 2192080
Show file tree
Hide file tree
Showing 45 changed files with 1,027 additions and 2,729 deletions.
27 changes: 18 additions & 9 deletions jest/jest-replace-attribute-snapshot-serializer.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Imports the appropriate plugin type from the library Jest uses for snapshot serialization.
import { NewPlugin } from 'pretty-format'
import { Config, NewPlugin, Printer, Refs } from 'pretty-format'

const DEFAULT_UUID = 'aaaabbbb-cccc-dddd-eeee-ffffffffffff'

function hasUuidAttribute(element: Element, attribute: string): boolean {
const value = element.getAttribute(attribute)

return value !== null && /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(value)
return value !== null && value !== DEFAULT_UUID && /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(value)
}

const processedValues = new Set()

export function replaceAttributesSnapshotSerializer(
attributes: string[],
uuid = DEFAULT_UUID,
Expand All @@ -19,21 +17,32 @@ export function replaceAttributesSnapshotSerializer(
/**
* Matches elements which haven’t been processed by this serializer before.
*/
test: (value) => value instanceof Element && !processedValues.has(value)
? attributes.some((attribute) => hasUuidAttribute(value, attribute))
: false,
test: (value: any) => {
if (!(value instanceof Element)) {
return false
}

return (
attributes.some((attribute) => hasUuidAttribute(value, attribute)) ||
Object.values(value.attributes).some((attribute) => attribute.name.startsWith('data-v-'))
)
},

/**
* Replaces the attribute values of an element with a static value.
*/
serialize: (value: Element, config, indentation, depth, refs, printer) => {
serialize: (value: Element, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => {
for (const attribute of attributes) {
if (hasUuidAttribute(value, attribute)) {
value.setAttribute(attribute, uuid)
}
}

processedValues.add(value)
for (const attribute of value.attributes) {
if (attribute.name.startsWith('data-v-')) {
value.removeAttribute(attribute.name)
}
}

return printer(value, config, indentation, depth, refs)
},
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,59 @@
"yarn": "^1.22.0"
},
"dependencies": {
"@amcharts/amcharts4": "^4.10.29",
"@amcharts/amcharts4": "^4.10.30",
"@appscode/json2yaml": "^0.1.2",
"@datadog/browser-logs": "^4.23.3",
"@kong/kongponents": "^8.3.0",
"@datadog/browser-logs": "^4.25.0",
"@kong/kongponents": "^8.6.2",
"prismjs": "^1.29.0",
"semver": "^7.3.8",
"semver-compare": "^1.0.0",
"tailwindcss": "^3.2.2",
"vue": "^3.2.41",
"tailwindcss": "^3.2.4",
"vue": "^3.2.45",
"vue-github-button": "^3.1.0",
"vue-router": "^4.1.6",
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@jest/globals": "^29.3.1",
"@types/prismjs": "^1.26.0",
"@types/semver": "^7.3.13",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.2.1",
"@vue/vue3-jest": "^29.2.0",
"@vue/test-utils": "^2.2.4",
"@vue/vue3-jest": "^29.2.1",
"autoprefixer": "^10.4.13",
"babel-jest": "^29.2.2",
"babel-jest": "^29.3.1",
"babel-plugin-transform-import-meta": "^2.2.0",
"babel-plugin-transform-vite-meta-env": "^1.0.3",
"cross-env": "^7.0.3",
"dotenv": "^16.0.3",
"eslint": "^8.27.0",
"eslint": "^8.28.0",
"eslint-config-standard": "^17.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.5.0",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.7.0",
"eslint-plugin-vue": "^9.8.0",
"isomorphic-fetch": "^3.0.0",
"jest": "^29.2.2",
"jest-environment-jsdom": "^29.2.2",
"jest-serializer-vue": "^2.0.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-serializer-vue": "^3.1.0",
"jest-transform-stub": "^2.0.0",
"lockfile-lint": "^4.9.6",
"msw": "~0.47.4",
"postcss": "^8.4.18",
"sass": "^1.56.0",
"msw": "~0.49.1",
"postcss": "^8.4.19",
"sass": "^1.56.1",
"standard": "^17.0.0",
"ts-jest": "^29.0.3",
"typescript": "~4.8.4",
"vite": "^3.2.2",
"typescript": "~4.9.3",
"vite": "^3.2.4",
"vite-plugin-rewrite-all": "^1.0.0",
"vite-svg-loader": "^3.6.0"
},
"browserslist": [
Expand Down
6 changes: 3 additions & 3 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/* tslint:disable */

/**
* Mock Service Worker (0.47.4).
* Mock Service Worker (0.49.1).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
*/

const INTEGRITY_CHECKSUM = 'b3066ef78c2f9090b4ce87e874965995'
const INTEGRITY_CHECKSUM = '3d6b9f06410d179a7f7404d4bf4c3c70'
const activeClientIds = new Set()

self.addEventListener('install', function () {
Expand Down Expand Up @@ -174,7 +174,7 @@ async function handleRequest(event, requestId) {
async function resolveMainClient(event) {
const client = await self.clients.get(event.clientId)

if (client.frameType === 'top-level') {
if (client?.frameType === 'top-level') {
return client
}

Expand Down
Loading

0 comments on commit 2192080

Please sign in to comment.