@websolutespa/test 3.1.0 → 3.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/test
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @websolutespa/payload-db-memory@3.1.1
8
+
3
9
  ## 3.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -9,27 +9,27 @@ Test shared config of the [BOM Repository](https://github.com/websolutespa/bom)
9
9
  ---
10
10
 
11
11
  ##### *this library is for internal usage and not production ready*
12
-
13
- ---
14
-
15
- ### Vitest configurations
16
-
17
- ```ts
18
- // vitest.config.ts
19
- import { definePayloadConfig } from '@websolutespa/test/vitest';
20
-
21
- export default definePayloadConfig();
22
- ```
23
-
24
- | factory | environment | use |
25
- | --- | --- | --- |
26
- | `defineNodeConfig` | node | libraries, server code |
27
- | `defineDomConfig` | jsdom + `@testing-library/jest-dom` matchers | react components and hooks |
28
- | `definePayloadConfig` | node, `BOM_TEST_DB=memory` by default | Payload suites built with `@websolutespa/test/payload` |
29
-
30
- Each factory accepts a vitest config, deep merged over the defaults.
31
-
32
- ### Payload test context
33
-
34
- `getContext(config, { db })` builds a Payload instance on `@websolutespa/payload-db-memory` (`db: 'memory'`, the default with `definePayloadConfig`)
35
- or on a mongo memory replica set (`db: 'mongo'`, or `BOM_TEST_DB=mongo`).
12
+
13
+ ---
14
+
15
+ ### Vitest configurations
16
+
17
+ ```ts
18
+ // vitest.config.ts
19
+ import { definePayloadConfig } from '@websolutespa/test/vitest';
20
+
21
+ export default definePayloadConfig();
22
+ ```
23
+
24
+ | factory | environment | use |
25
+ | --- | --- | --- |
26
+ | `defineNodeConfig` | node | libraries, server code |
27
+ | `defineDomConfig` | jsdom + `@testing-library/jest-dom` matchers | react components and hooks |
28
+ | `definePayloadConfig` | node, `BOM_TEST_DB=memory` by default | Payload suites built with `@websolutespa/test/payload` |
29
+
30
+ Each factory accepts a vitest config, deep merged over the defaults.
31
+
32
+ ### Payload test context
33
+
34
+ `getContext(config, { db })` builds a Payload instance on `@websolutespa/payload-db-memory` (`db: 'memory'`, the default with `definePayloadConfig`)
35
+ or on a mongo memory replica set (`db: 'mongo'`, or `BOM_TEST_DB=mongo`).
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-setup-dom.js","names":[],"sources":["../../src/exports/vitest-setup-dom.ts"],"sourcesContent":["// vitest setup of `defineDomConfig`: `@testing-library/jest-dom` matchers and dom cleanup between tests\nimport '@testing-library/jest-dom/vitest';\nimport { cleanup } from '@testing-library/react';\nimport { afterEach } from 'vitest';\n\nafterEach(() => {\n cleanup();\n});\n"],"mappings":";;;;AAKA,gBAAgB;AACd,UAAS;EACT"}
1
+ {"version":3,"file":"vitest-setup-dom.js","names":[],"sources":["../../src/exports/vitest-setup-dom.ts"],"sourcesContent":["// vitest setup of `defineDomConfig`: `@testing-library/jest-dom` matchers and dom cleanup between tests\r\nimport '@testing-library/jest-dom/vitest';\r\nimport { cleanup } from '@testing-library/react';\r\nimport { afterEach } from 'vitest';\r\n\r\nafterEach(() => {\r\n cleanup();\r\n});\r\n"],"mappings":";;;;AAKA,gBAAgB;AACd,UAAS;EACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.js","names":[],"sources":["../../src/exports/vitest.ts"],"sourcesContent":["import react from '@vitejs/plugin-react';\nimport { configDefaults, defineConfig, mergeConfig, type ViteUserConfig } from 'vitest/config';\n\n/**\n * Shared vitest configurations of the BOM Repository.\n * Each factory takes an optional config, deep merged over the defaults.\n *\n * @example\n * ```ts\n * // vitest.config.ts\n * import { definePayloadConfig } from '@websolutespa/test/vitest';\n * export default definePayloadConfig();\n * ```\n */\n\nconst baseConfig: ViteUserConfig = {\n plugins: [react()],\n resolve: {\n tsconfigPaths: true,\n },\n test: {\n environment: 'node',\n // build outputs may contain compiled test files\n exclude: [...configDefaults.exclude, '**/dist/**', '**/.next/**'],\n hookTimeout: 30_000,\n testTimeout: 30_000,\n },\n};\n\n/**\n * Node environment, for libraries and server code.\n */\nexport function defineNodeConfig(config: ViteUserConfig = {}) {\n return defineConfig(mergeConfig(baseConfig, config));\n}\n\n/**\n * jsdom environment with the `@testing-library/jest-dom` matchers, for react components and hooks.\n */\nexport function defineDomConfig(config: ViteUserConfig = {}) {\n return defineConfig(mergeConfig(mergeConfig(baseConfig, {\n test: {\n environment: 'jsdom',\n setupFiles: ['@websolutespa/test/vitest-setup-dom'],\n },\n }), config));\n}\n\n/**\n * Node environment for Payload integration suites built with `@websolutespa/test/payload`.\n * Uses the in-memory database by default, `BOM_TEST_DB=mongo` switches to a mongo replica set.\n * Node, not jsdom: jsdom breaks the Payload REST api.\n */\nexport function definePayloadConfig(config: ViteUserConfig = {}) {\n return defineConfig(mergeConfig(mergeConfig(baseConfig, {\n test: {\n // payload init seeds the database\n hookTimeout: 5 * 60_000,\n env: {\n BOM_TEST_DB: process.env.BOM_TEST_DB || 'memory',\n },\n },\n }), config));\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,aAA6B;CACjC,SAAS,CAAC,OAAO,CAAC;CAClB,SAAS,EACP,eAAe,MAChB;CACD,MAAM;EACJ,aAAa;EAEb,SAAS;GAAC,GAAG,eAAe;GAAS;GAAc;GAAc;EACjE,aAAa;EACb,aAAa;EACd;CACF;;;;AAKD,SAAgB,iBAAiB,SAAyB,EAAE,EAAE;AAC5D,QAAO,aAAa,YAAY,YAAY,OAAO,CAAC;;;;;AAMtD,SAAgB,gBAAgB,SAAyB,EAAE,EAAE;AAC3D,QAAO,aAAa,YAAY,YAAY,YAAY,EACtD,MAAM;EACJ,aAAa;EACb,YAAY,CAAC,sCAAsC;EACpD,EACF,CAAC,EAAE,OAAO,CAAC;;;;;;;AAQd,SAAgB,oBAAoB,SAAyB,EAAE,EAAE;AAC/D,QAAO,aAAa,YAAY,YAAY,YAAY,EACtD,MAAM;EAEJ,aAAa,IAAI;EACjB,KAAK,EACH,aAAa,QAAQ,IAAI,eAAe,UACzC;EACF,EACF,CAAC,EAAE,OAAO,CAAC"}
1
+ {"version":3,"file":"vitest.js","names":[],"sources":["../../src/exports/vitest.ts"],"sourcesContent":["import react from '@vitejs/plugin-react';\r\nimport { configDefaults, defineConfig, mergeConfig, type ViteUserConfig } from 'vitest/config';\r\n\r\n/**\r\n * Shared vitest configurations of the BOM Repository.\r\n * Each factory takes an optional config, deep merged over the defaults.\r\n *\r\n * @example\r\n * ```ts\r\n * // vitest.config.ts\r\n * import { definePayloadConfig } from '@websolutespa/test/vitest';\r\n * export default definePayloadConfig();\r\n * ```\r\n */\r\n\r\nconst baseConfig: ViteUserConfig = {\r\n plugins: [react()],\r\n resolve: {\r\n tsconfigPaths: true,\r\n },\r\n test: {\r\n environment: 'node',\r\n // build outputs may contain compiled test files\r\n exclude: [...configDefaults.exclude, '**/dist/**', '**/.next/**'],\r\n hookTimeout: 30_000,\r\n testTimeout: 30_000,\r\n },\r\n};\r\n\r\n/**\r\n * Node environment, for libraries and server code.\r\n */\r\nexport function defineNodeConfig(config: ViteUserConfig = {}) {\r\n return defineConfig(mergeConfig(baseConfig, config));\r\n}\r\n\r\n/**\r\n * jsdom environment with the `@testing-library/jest-dom` matchers, for react components and hooks.\r\n */\r\nexport function defineDomConfig(config: ViteUserConfig = {}) {\r\n return defineConfig(mergeConfig(mergeConfig(baseConfig, {\r\n test: {\r\n environment: 'jsdom',\r\n setupFiles: ['@websolutespa/test/vitest-setup-dom'],\r\n },\r\n }), config));\r\n}\r\n\r\n/**\r\n * Node environment for Payload integration suites built with `@websolutespa/test/payload`.\r\n * Uses the in-memory database by default, `BOM_TEST_DB=mongo` switches to a mongo replica set.\r\n * Node, not jsdom: jsdom breaks the Payload REST api.\r\n */\r\nexport function definePayloadConfig(config: ViteUserConfig = {}) {\r\n return defineConfig(mergeConfig(mergeConfig(baseConfig, {\r\n test: {\r\n // payload init seeds the database\r\n hookTimeout: 5 * 60_000,\r\n env: {\r\n BOM_TEST_DB: process.env.BOM_TEST_DB || 'memory',\r\n },\r\n },\r\n }), config));\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,aAA6B;CACjC,SAAS,CAAC,OAAO,CAAC;CAClB,SAAS,EACP,eAAe,MAChB;CACD,MAAM;EACJ,aAAa;EAEb,SAAS;GAAC,GAAG,eAAe;GAAS;GAAc;GAAc;EACjE,aAAa;EACb,aAAa;EACd;CACF;;;;AAKD,SAAgB,iBAAiB,SAAyB,EAAE,EAAE;AAC5D,QAAO,aAAa,YAAY,YAAY,OAAO,CAAC;;;;;AAMtD,SAAgB,gBAAgB,SAAyB,EAAE,EAAE;AAC3D,QAAO,aAAa,YAAY,YAAY,YAAY,EACtD,MAAM;EACJ,aAAa;EACb,YAAY,CAAC,sCAAsC;EACpD,EACF,CAAC,EAAE,OAAO,CAAC;;;;;;;AAQd,SAAgB,oBAAoB,SAAyB,EAAE,EAAE;AAC/D,QAAO,aAAa,YAAY,YAAY,YAAY,EACtD,MAAM;EAEJ,aAAa,IAAI;EACjB,KAAK,EACH,aAAa,QAAQ,IAAI,eAAe,UACzC;EACF,EACF,CAAC,EAAE,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/test",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Test shared config of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -35,7 +35,7 @@
35
35
  "@testing-library/jest-dom": "7.0.1",
36
36
  "@testing-library/react": "16.3.3",
37
37
  "@vitejs/plugin-react": "6.1.2",
38
- "@websolutespa/payload-db-memory": "^3.1.0",
38
+ "@websolutespa/payload-db-memory": "^3.1.1",
39
39
  "jsdom": "30.1.3",
40
40
  "mongodb-memory-server": "11.3.0",
41
41
  "qs-esm": "7.0.2",
@@ -43,7 +43,7 @@
43
43
  "vite": "8.3.5"
44
44
  },
45
45
  "devDependencies": {
46
- "@websolutespa/eslint-config": "^3.1.0",
46
+ "@websolutespa/eslint-config": "^3.1.1",
47
47
  "eslint": "10.13.0",
48
48
  "next": "16.4.2",
49
49
  "tsdown": "0.21.0",