@unimelb/pattern-lib-vue 16.0.0-alpha.3 → 16.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/.out/vue.js +1 -1
  2. package/README.md +45 -3
  3. package/package.json +41 -40
package/README.md CHANGED
@@ -182,6 +182,20 @@ Pre-release builds can be created like this (using the git pre-push hook behind
182
182
 
183
183
  ## Testing
184
184
 
185
+ ### Component unit testing
186
+ To run the component units tests use `yarn test`. This runs the jest unit and accessibility tests.
187
+
188
+ ### Storybook end-to-end testing
189
+ To run the Storybook stories visual snapshots and story tests use `yarn test:e2e`.
190
+
191
+ ### Storybook visual snapshot testing
192
+
193
+ You can run the Storybook stories visual snapshot tests using `yarn test:snapshots`. This compares your changes against the baseline visual snapshot. To see the failed snapshot tests run `yarn test:report`.
194
+
195
+ If you wish to update the snapshots with your changes run `yarn test:update:snapshots`.
196
+
197
+ **Note:** the visual snapshot testing runs on Playwright and requires Docker to be up and running.
198
+
185
199
  ### Testing Pull-requests
186
200
 
187
201
  You can test `pull-requests` on live sites by using `?preview=test-xxx` where `xxx` is the pull-request `number`.
@@ -212,11 +226,39 @@ Recommended mobile devices for testing:
212
226
  - iPad 2
213
227
  - Galaxy s5
214
228
 
215
- ### Visual snapshot testing
229
+ ### Visual Regression Tests
230
+
231
+ > [!IMPORTANT]
232
+ > These tests should be run `exclusively` on your `local` machine to detect visual regressions before merging your `pull-request`.
233
+
234
+ You can test your changes against live `production` sites to ensure nothing breaks.
235
+
236
+ - uses `TEST_PREVIEW_ID` located in `.env` - refer to `env.example`
237
+ - the list of production sites are located in `/e2e/tests/regression/pages.json`
238
+
239
+ #### Running regression tests
240
+
241
+ 1. update your regression snapshots
216
242
 
217
- You can run visual snapshot testing using `yarn test:snapshots`. This compares your changes against the latest visual snapshot. Failed snapshot tests will show a visual diff comparison in `snapshots/__tests__/__image_snapshots__/__diff_output__`.
243
+ > [!TIP]
244
+ > Make sure to comment out `TEST_PREVIEW_ID` to use the `dev` branch as the `base` snapshots. Alternatively, you can use any `pull-request` id.
245
+
246
+ ```
247
+ yarn test:update:regression
248
+ ```
249
+
250
+ 2. set the `TEST_PREVIEW_ID` to your desired `pull-request` id
251
+ 3. run the regression tests to compare your `pull-request` againts the base snapshots
218
252
 
219
- If you wish to update the snapshots with your changes run `yarn test:e2e:updatesnapshots`.
253
+ ```bash
254
+ yarn test:regression
255
+ ```
256
+
257
+ 4. view the report
258
+
259
+ ```bash
260
+ yarn test:report
261
+ ```
220
262
 
221
263
  ## Developer documentation
222
264
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unimelb/pattern-lib-vue",
3
3
  "description": "A complete design system for the University of Melbourne.",
4
- "version": "16.0.0-alpha.3",
4
+ "version": "16.0.0-alpha.30",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/unimelb/pattern-lib.git"
@@ -9,9 +9,10 @@
9
9
  "author": "The University of Melbourne",
10
10
  "license": "UNLICENSED",
11
11
  "engines": {
12
- "node": "^20.16.0",
12
+ "node": ">=22.3.0",
13
13
  "yarn": "*"
14
14
  },
15
+ "type": "module",
15
16
  "main": ".out/vue.js",
16
17
  "files": [
17
18
  ".out/vue.js"
@@ -21,36 +22,40 @@
21
22
  "prebuild:lib": "rimraf .out/lib",
22
23
  "build": "storybook build -o .out/docs",
23
24
  "build:lib": "run-p build:lib:standard build:lib:minify",
24
- "build:lib:standard": "cross-env NODE_ENV=production webpack --config targets/lib/webpack.config.js",
25
- "build:lib:minify": "cross-env NODE_ENV=production MINIFY_CSS=true webpack --config targets/lib/webpack.minify.config.js",
26
- "build:vue": "cross-env NODE_ENV=production webpack --config targets/vue/webpack.config.js",
27
- "clean:snapshots": "rimraf snapshots/__tests__/__image_snapshots__/__diff_output__",
25
+ "build:lib:standard": "cross-env NODE_ENV=production webpack --config targets/lib/webpack.config.cjs",
26
+ "build:lib:minify": "cross-env NODE_ENV=production MINIFY_CSS=true webpack --config targets/lib/webpack.minify.config.cjs",
27
+ "build:vue": "cross-env NODE_ENV=production webpack --config targets/vue/webpack.config.cjs",
28
+ "prebuild:test": "rimraf _site-docker",
29
+ "build:test": "cross-env MOCK=true npm-run-all \"build -o _site-docker\"",
28
30
  "dev": "storybook dev -p 7002",
29
- "dev:public": "start-storybook -p 7002 -h 0.0.0.0",
30
- "start:lib": "webpack-dev-server --port 7003 --config targets/lib/webpack.config.js",
31
- "docker": "docker compose --profile dev up --abort-on-container-exit --remove-orphans",
31
+ "dev:public": "storybook dev -p 7002 -h 0.0.0.0",
32
+ "start:lib": "webpack-dev-server --port 7003 --config targets/lib/webpack.config.cjs",
32
33
  "docker:build": "cross-env MODE=build docker compose run --rm storybook",
33
34
  "lint": "run-s lint:js lint:css",
34
35
  "lint:css": "stylelint **/*.{css,vue} --fix",
35
36
  "lint:js": "eslint . --ext .js,.vue --fix",
36
- "start:snapshots": "server-test serve:test :5000 'jest -w=4 -c snapshots/jest.config.js'",
37
- "start:updatesnapshots": "server-test serve:test :5000 'jest -w=4 -c snapshots/jest.config.js -u'",
38
37
  "test": "jest",
39
- "test:snapshots": "run-s build clean:snapshots start:snapshots",
40
- "test:updatesnapshots": "run-s build start:updatesnapshots",
38
+ "test:e2e": "cross-env EXCLUDE=regression run-s docker",
39
+ "test:regression": "cross-env TYPE=regression run-s docker",
40
+ "test:snapshots": "cross-env TYPE=snapshot run-s docker",
41
+ "test:update:regression": "cross-env TYPE=regression UPDATE_SNAPSHOTS=all run-s docker",
42
+ "test:update:snapshots": "cross-env TYPE=snapshot UPDATE_SNAPSHOTS=all run-s docker",
43
+ "test:update:regression:changed": "cross-env TYPE=regression UPDATE_SNAPSHOTS=changed run-s docker",
44
+ "test:update:snapshots:changed": "cross-env TYPE=snapshot UPDATE_SNAPSHOTS=changed run-s docker",
45
+ "test:report": "playwright show-report",
41
46
  "generate": "plop --plopfile generator/index.js",
42
47
  "prepublish": "cross-env LOAD_EXTERNAL_ASSETS=true npm run build:vue",
43
- "serve:test": "serve .out/docs"
48
+ "preplaywright": "npm-run-all build:test",
49
+ "playwright": "npx playwright test --grep-invert \"@snapshot|@regression\" --project chromium",
50
+ "playwright:ui": "npx playwright test --grep-invert \"@snapshot|@regression\" --project chromium --ui",
51
+ "predocker": "npm-run-all build:test",
52
+ "docker": "docker compose run --rm e2e"
44
53
  },
45
54
  "dependencies": {
46
55
  "@fontsource-variable/fraunces": "^5.0.21",
47
56
  "@fontsource/source-sans-pro": "^5.0.8",
48
- "@storybook/channels": "^8.1.11",
49
- "@storybook/global": "^5.0.0",
50
- "@storybook/preview-api": "^8.1.11",
51
- "@storybook/test": "^8.1.11",
52
- "@vue/compat": "^3.4.35",
53
- "@vue/vue3-jest": "^29.2.6",
57
+ "@splidejs/vue-splide": "^0.6.12",
58
+ "@vue/compat": "^3.5.4",
54
59
  "babel-polyfill": "^6.26.0",
55
60
  "change-case": "^3.1.0",
56
61
  "core-js": "3",
@@ -62,22 +67,23 @@
62
67
  "modern-normalize": "^1.1.0",
63
68
  "prop-types": "^15.8.1",
64
69
  "semver": "^5.6.0",
70
+ "serve-handler": "^6.1.6",
65
71
  "smoothscroll-polyfill": "^0.4.4",
66
72
  "throttle-debounce": "^2.1.0",
67
73
  "uuid": "^3.4.0",
68
74
  "v-scroll-lock": "^1.3.1",
69
- "vue": "^3.4.35",
70
- "vue-concise-slider": "^3.4.2",
75
+ "vue": "^3.5.4",
71
76
  "vue-focus-lock": "1.4.0",
72
- "vue-progressive-image": "3.2.0",
73
77
  "xss": "^1.0.15"
74
78
  },
75
79
  "devDependencies": {
80
+ "@axe-core/playwright": "^4.10.2",
76
81
  "@babel/core": "^7.24.8",
77
82
  "@babel/eslint-parser": "^7.24.7",
78
83
  "@babel/polyfill": "^7.12.1",
79
84
  "@babel/preset-env": "^7.24.8",
80
85
  "@babel/preset-react": "^7.24.7",
86
+ "@playwright/test": "^1.53.0",
81
87
  "@storybook/addon-essentials": "^8.1.11",
82
88
  "@storybook/addon-interactions": "^8.1.11",
83
89
  "@storybook/addon-links": "^8.1.11",
@@ -86,14 +92,20 @@
86
92
  "@storybook/addon-postcss": "^2.0.0",
87
93
  "@storybook/addon-webpack5-compiler-swc": "^1.0.4",
88
94
  "@storybook/addons": "^3.4.8",
95
+ "@storybook/api": "^7.6.17",
89
96
  "@storybook/blocks": "^8.1.11",
97
+ "@storybook/channels": "^8.1.11",
98
+ "@storybook/global": "^5.0.0",
99
+ "@storybook/manager-api": "^8.3.1",
100
+ "@storybook/preview-api": "^8.1.11",
101
+ "@storybook/test": "^8.1.11",
90
102
  "@storybook/vue3": "^8.1.11",
91
103
  "@storybook/vue3-webpack5": "^8.1.11",
92
- "@types/jest": "^25.2.3",
93
104
  "@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
94
105
  "@vue/babel-plugin-transform-vue-jsx": "^1.4.0",
95
106
  "@vue/compiler-sfc": "^3.4.31",
96
107
  "@vue/test-utils": "^2.4.0-alpha.2",
108
+ "@vue/vue3-jest": "^29.2.6",
97
109
  "babel-core": "^6.26.3",
98
110
  "babel-helper-vue-jsx-merge-props": "^2.0.3",
99
111
  "babel-jest": "29.x",
@@ -109,6 +121,7 @@
109
121
  "css-loader": "^7.1.2",
110
122
  "css-mqpacker": "^7.0.0",
111
123
  "cssnano": "^4.1.10",
124
+ "cssnano-preset-lite": "^1.0.1",
112
125
  "dotenv": "^6.0.0",
113
126
  "eslint": "^7.32.0",
114
127
  "eslint-config-airbnb-base": "^15.0.0",
@@ -119,17 +132,17 @@
119
132
  "eslint-plugin-vue": "^9.20.1",
120
133
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
121
134
  "file-loader": "^6.2.0",
135
+ "highlight.js": "^11.10.0",
122
136
  "html-webpack-plugin": "^5.6.0",
137
+ "http-server": "^14.1.1",
123
138
  "husky": "^4.2.3",
124
139
  "inquirer-directory": "^2.2.0",
125
140
  "jest": "29.x",
126
141
  "jest-axe": "^3.1.1",
127
142
  "jest-environment-jsdom": "^29.7.0",
128
- "jest-image-snapshot": "^2.12.0",
129
- "jest-puppeteer": "^4.4.0",
130
- "jest-serializer-vue": "^2.0.2",
131
143
  "jest-transform-stub": "^2.0.0",
132
144
  "lint-staged": "^10.0.8",
145
+ "marked": "^14.1.2",
133
146
  "mini-css-extract-plugin": "^2.9.0",
134
147
  "npm-run-all": "^4.1.5",
135
148
  "plop": "^2.4.0",
@@ -147,8 +160,6 @@
147
160
  "postcss-reporter": "^7.1.0",
148
161
  "postcss-url": "^10.1.3",
149
162
  "prettier": "^3.3.2",
150
- "pretty": "^2.0.0",
151
- "puppeteer": "^2.1.1",
152
163
  "raw-loader": "^0.5.1",
153
164
  "react": "18",
154
165
  "react-dom": "18",
@@ -165,7 +176,6 @@
165
176
  "stylelint-config-recommended-vue": "^1.5.0",
166
177
  "stylelint-config-standard": "^29.0.0",
167
178
  "stylelint-order": "^5.0.0",
168
- "svg-fill-loader": "^0.0.8",
169
179
  "svg-sprite-loader": "^6.0.11",
170
180
  "svg-url-loader": "^7.1.1",
171
181
  "svgo": "^3.3.2",
@@ -174,7 +184,6 @@
174
184
  "vue-axe": "^1.0.7",
175
185
  "vue-html-loader": "^1.2.4",
176
186
  "vue-loader": "^17.4.2",
177
- "vue3-jest": "^27.0.0-alpha.1",
178
187
  "webpack": "^5.92.1",
179
188
  "webpack-bundle-analyzer": "^4.10.2",
180
189
  "webpack-cli": "^5.1.4",
@@ -201,9 +210,6 @@
201
210
  "^utils/(.*)$": "<rootDir>/utils/$1",
202
211
  "^static/(.*)$": "<rootDir>/static/$1"
203
212
  },
204
- "snapshotSerializers": [
205
- "<rootDir>/node_modules/jest-serializer-vue"
206
- ],
207
213
  "transform": {
208
214
  ".*\\.(vue)$": "@vue/vue3-jest",
209
215
  "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
@@ -211,7 +217,7 @@
211
217
  },
212
218
  "transformIgnorePatterns": [],
213
219
  "testPathIgnorePatterns": [
214
- "<rootDir>/snapshots/"
220
+ "<rootDir>/e2e/"
215
221
  ],
216
222
  "testEnvironmentOptions": {
217
223
  "customExportConditions": [
@@ -228,10 +234,5 @@
228
234
  "hooks": {
229
235
  "pre-commit": "cross-env lint-staged"
230
236
  }
231
- },
232
- "eslintConfig": {
233
- "extends": [
234
- "plugin:storybook/recommended"
235
- ]
236
237
  }
237
238
  }