twd-js 1.7.1 → 1.7.3
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/README.md +26 -4
- package/dist/asserts/index.d.ts +2 -0
- package/dist/bundled.d.ts +4 -1
- package/dist/bundled.es.js +9861 -602
- package/dist/cli.js +11 -11
- package/dist/commands/mockBridge.d.ts +117 -0
- package/dist/commands/url.d.ts +33 -0
- package/dist/commands/viewport.d.ts +2 -0
- package/dist/commands/visit.d.ts +1 -0
- package/dist/constants/version.d.ts +1 -0
- package/dist/global.d.ts +20 -0
- package/dist/index.cjs.js +33 -33
- package/dist/index.d.ts +8 -664
- package/dist/index.es.js +1695 -1657
- package/dist/initializers/initSidebar.d.ts +29 -0
- package/dist/initializers/initTests.d.ts +36 -0
- package/dist/mock-sw.js +1 -1
- package/dist/plugin/removeMockServiceWorker.d.ts +18 -0
- package/dist/plugin/twdHmr.d.ts +45 -0
- package/dist/proxies/domMessage.d.ts +1 -0
- package/dist/proxies/eventsMessage.d.ts +1 -0
- package/dist/proxies/screenDom.d.ts +45 -0
- package/dist/proxies/userEvent.d.ts +4 -0
- package/dist/runner-ci.d.ts +12 -28
- package/dist/runner.d.ts +52 -63
- package/dist/twd-types.d.ts +120 -0
- package/dist/twd.d.ts +291 -0
- package/dist/ui/ClosedSidebar.d.ts +6 -0
- package/dist/ui/Icons/BaseIcon.d.ts +7 -0
- package/dist/ui/Icons/ChevronDown.d.ts +2 -0
- package/dist/ui/Icons/ChevronRight.d.ts +2 -0
- package/dist/ui/Icons/Loader.d.ts +2 -0
- package/dist/ui/Icons/MockRequestIcon.d.ts +2 -0
- package/dist/ui/Icons/Play.d.ts +2 -0
- package/dist/ui/LogItem.d.ts +6 -0
- package/dist/ui/MockRulesButton.d.ts +1 -0
- package/dist/ui/MockedComponent.d.ts +6 -0
- package/dist/ui/SearchInput.d.ts +6 -0
- package/dist/ui/SkipOnlyName.d.ts +8 -0
- package/dist/ui/TWDSidebar.d.ts +20 -0
- package/dist/ui/TestList.d.ts +8 -0
- package/dist/ui/TestListItem.d.ts +19 -0
- package/dist/ui/componentMocks.d.ts +3 -0
- package/dist/ui/hooks/useLayout.d.ts +6 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/utils/buildTreeFromHandlers.d.ts +16 -0
- package/dist/ui/utils/chaiErrorFormat.d.ts +22 -0
- package/dist/ui/utils/filterTree.d.ts +2 -0
- package/dist/ui/utils/formatLogs.d.ts +30 -0
- package/dist/ui/utils/screenReaderMessages.d.ts +9 -0
- package/dist/ui/utils/styles.d.ts +7 -0
- package/dist/ui/utils/theme.d.ts +74 -0
- package/dist/ui.d.ts +2 -10
- package/dist/utils/assertionMessage.d.ts +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/wait.d.ts +3 -0
- package/dist/utils/waitFor.d.ts +2 -0
- package/dist/vite-plugin.d.ts +2 -67
- package/package.json +31 -7
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Vite plugin to remove the mock service worker file from the build output.
|
|
5
|
-
* This is useful for production builds where you don't want the mock service worker to be included.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { removeMockServiceWorker } from 'twd-js';
|
|
10
|
-
*
|
|
11
|
-
* export default defineConfig({
|
|
12
|
-
* plugins: [
|
|
13
|
-
* // ... other plugins
|
|
14
|
-
* removeMockServiceWorker()
|
|
15
|
-
* ]
|
|
16
|
-
* });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function removeMockServiceWorker(): Plugin_2;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Vite plugin to handle HMR for TWD test files.
|
|
23
|
-
* When a TWD test file is updated, it forces a full page reload to prevent
|
|
24
|
-
* duplicate test entries that occur when HMR reloads test modules.
|
|
25
|
-
*
|
|
26
|
-
* This plugin only runs in development mode (serve) and does not affect Vitest test runs.
|
|
27
|
-
*
|
|
28
|
-
* @param options - Configuration options for the plugin
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* import { twdHmr } from 'twd-js/vite-plugin';
|
|
32
|
-
*
|
|
33
|
-
* export default defineConfig({
|
|
34
|
-
* plugins: [
|
|
35
|
-
* // ... other plugins
|
|
36
|
-
* twdHmr() // Uses default pattern: .twd.test.ts
|
|
37
|
-
* ]
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* // Custom pattern
|
|
43
|
-
* twdHmr({ testFilePattern: '.twd.test.tsx' })
|
|
44
|
-
* ```
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* // Custom function
|
|
48
|
-
* twdHmr({
|
|
49
|
-
* testFilePattern: (file) => file.includes('.twd.test.')
|
|
50
|
-
* })
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare function twdHmr(options?: TwdHmrOptions): Plugin_2;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Options for the TWD HMR plugin.
|
|
57
|
-
*/
|
|
58
|
-
export declare interface TwdHmrOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Pattern to match test files. Defaults to `.twd.test.ts`.
|
|
61
|
-
* Can be a string (checked with `endsWith`) or a function that returns a boolean.
|
|
62
|
-
* @default ".twd.test.ts"
|
|
63
|
-
*/
|
|
64
|
-
testFilePattern?: string | ((file: string) => boolean);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { }
|
|
1
|
+
export { removeMockServiceWorker } from './plugin/removeMockServiceWorker';
|
|
2
|
+
export { twdHmr, type TwdHmrOptions } from './plugin/twdHmr';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twd-js",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Test While Developing (TWD) - in-browser testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
"build": "vite build && vite build -c vite.sw.config.js && NODE_ENV=production vite build -c vite.bundle.config.ts && cp src/cli/installsw.js dist/cli.js",
|
|
65
65
|
"test": "vitest",
|
|
66
66
|
"test:ci": "vitest --run --coverage",
|
|
67
|
+
"lint": "eslint src",
|
|
68
|
+
"lint:fix": "eslint src --fix",
|
|
69
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,json,md}\"",
|
|
70
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,json,md}\"",
|
|
71
|
+
"check:only": "scripts/check-only-tests.sh",
|
|
67
72
|
"conventional-changelog": "conventional-changelog -i CHANGELOG.md",
|
|
68
73
|
"dev": "vite",
|
|
69
74
|
"docs:dev": "vitepress dev docs",
|
|
@@ -72,27 +77,46 @@
|
|
|
72
77
|
"copy:mock-sw": "cp dist/mock-sw.js examples/twd-test-app/public/mock-sw.js && cp dist/mock-sw.js examples/tutorial-example/public/mock-sw.js && cp dist/mock-sw.js examples/vue-twd-example/public/mock-sw.js",
|
|
73
78
|
"copy:dist:vue-twd-example": "cp -r dist examples/vue-twd-example/src",
|
|
74
79
|
"copy:dist:tutorial-example": "cp -r dist examples/tutorial-example/src",
|
|
75
|
-
"copy:dist:examples": "npm run copy:dist:vue-twd-example && npm run copy:dist:tutorial-example"
|
|
80
|
+
"copy:dist:examples": "npm run copy:dist:vue-twd-example && npm run copy:dist:tutorial-example",
|
|
81
|
+
"prepare": "husky"
|
|
82
|
+
},
|
|
83
|
+
"lint-staged": {
|
|
84
|
+
"src/**/*.{ts,tsx}": [
|
|
85
|
+
"eslint --fix",
|
|
86
|
+
"prettier --write"
|
|
87
|
+
],
|
|
88
|
+
"src/**/*.{json,md}": [
|
|
89
|
+
"prettier --write"
|
|
90
|
+
]
|
|
76
91
|
},
|
|
77
92
|
"peerDependencies": {
|
|
78
93
|
"react": ">=17.0.0",
|
|
79
94
|
"react-dom": ">=17.0.0"
|
|
80
95
|
},
|
|
81
96
|
"devDependencies": {
|
|
97
|
+
"@eslint/js": "^9.39.4",
|
|
82
98
|
"@preact/preset-vite": "^2.10.5",
|
|
83
99
|
"@testing-library/jest-dom": "^6.9.1",
|
|
84
100
|
"@testing-library/react": "^16.3.2",
|
|
85
101
|
"@types/react": "^19.2.14",
|
|
86
102
|
"@types/react-dom": "^19.2.3",
|
|
87
103
|
"@vitejs/plugin-react": "^6.0.1",
|
|
88
|
-
"@vitest/coverage-v8": "^4.1.
|
|
104
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
105
|
+
"@vitest/eslint-plugin": "^1.6.16",
|
|
89
106
|
"conventional-changelog": "^7.2.0",
|
|
90
|
-
"
|
|
107
|
+
"eslint": "^9.39.4",
|
|
108
|
+
"eslint-config-prettier": "^10.1.8",
|
|
109
|
+
"globals": "^17.6.0",
|
|
110
|
+
"husky": "^9.1.7",
|
|
111
|
+
"jsdom": "^29.1.1",
|
|
112
|
+
"lint-staged": "^16.4.0",
|
|
113
|
+
"prettier": "^3.8.3",
|
|
91
114
|
"typescript": "~5.9.3",
|
|
92
|
-
"
|
|
93
|
-
"vite
|
|
115
|
+
"typescript-eslint": "^8.59.1",
|
|
116
|
+
"vite": "^8.0.10",
|
|
117
|
+
"vite-plugin-dts": "^5.0.0",
|
|
94
118
|
"vitepress": "^2.0.0-alpha.12",
|
|
95
|
-
"vitest": "^4.1.
|
|
119
|
+
"vitest": "^4.1.5"
|
|
96
120
|
},
|
|
97
121
|
"keywords": [
|
|
98
122
|
"testing",
|