bimplus-renderer 1.8.38-updatepackages1.3 → 1.8.38

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.
@@ -15,27 +15,20 @@ This solution successfully implements moment-timezone dependency injection speci
15
15
  ### 2. Test-Only Injection
16
16
  - **[test/setup/momentTimezoneInjector.js](test/setup/momentTimezoneInjector.js)**: Test setup that injects moment-timezone globally
17
17
  - **package.json**: moment-timezone installed as `devDependency` only
18
- - **karma-files-config.js**: Loads injector before any test files
18
+ - **[test/setup/vitestBrowser.setup.js](test/setup/vitestBrowser.setup.js)**: Imports and injects moment-timezone before test modules
19
19
 
20
20
  ### 3. Test Configuration
21
21
  ```javascript
22
- // In karma-files-config.js
23
- files: [
24
- "src/**/*.js",
25
- // Load test environment setup (inject moment-timezone for tests)
26
- "test/setup/momentTimezoneInjector.js",
27
- // Load custom assertions first
28
- "test/customAsserts.js",
29
- // Load test files
30
- "test/**/*.js",
31
- ],
22
+ // In test/setup/vitestBrowser.setup.js
23
+ import momentTimezone from 'moment-timezone';
24
+ globalThis.MomentTZ = globalThis.moment = momentTimezone;
32
25
  ```
33
26
 
34
27
  ## How It Works
35
28
 
36
29
  ### For Tests
37
- 1. Karma loads the moment-timezone injector first
38
- 2. The injector imports moment-timezone (available as dev dependency)
30
+ 1. Vitest loads the browser setup before test modules
31
+ 2. The setup imports moment-timezone (available as a dev dependency)
39
32
  3. Injects it into global scope (`window.moment`)
40
33
  4. All tests run with moment-timezone available
41
34
  5. Sun calculation tests pass with accurate timezone handling
@@ -53,7 +46,7 @@ files: [
53
46
  - `test/setup/momentTimezoneInjector.js` - Test environment setup
54
47
 
55
48
  ### Modified Files
56
- - `karma-files-config.js` - Added test setup loader
49
+ - `test/setup/vitestBrowser.setup.js` - Imports and injects moment-timezone before test modules
57
50
  - `package.json` - Added moment-timezone as devDependency
58
51
 
59
52
  ### Existing Files (Unchanged)
package/README.md CHANGED
@@ -79,11 +79,79 @@ goto your application folder which uses the renderer
79
79
  npm install
80
80
 
81
81
  ### Unit testing
82
- With every build output is copied also to the test folder.
83
- To run the unit tests go to the test subfolder and run
84
-
85
- npm install
86
- npm run test
82
+ Run tests from the renderer root. Vitest is the only installed test runner; the
83
+ test files import Vitest APIs directly. Browser globals, fixtures, and
84
+ test-only dependencies are initialized in `test/setup/vitestBrowser.setup.js`.
85
+
86
+ ```sh
87
+ npm ci
88
+ npx playwright install firefox
89
+ npm test
90
+ npm run test-chrome-headed
91
+ npm run test-firefox-coverage
92
+ ```
93
+
94
+ `npm test` runs the renderer and performance suites in headless Firefox and
95
+ starts the Polly recording service. Every run generates Istanbul coverage at
96
+ `coverage/lcov.info` and `coverage/index.html` for CI/CD and SonarQube.
97
+ Jenkins must use Firefox with WebGL2; Chrome
98
+ has memory/WebGL problems on that server. `npm run test-chrome` uses installed
99
+ Google Chrome locally. `npm run test-chrome` and `npm run test-firefox` explicitly
100
+ show the browser window. Both profiles run serially. The explicit modes are:
101
+
102
+ | Mode | Firefox | Chrome |
103
+ | --- | --- | --- |
104
+ | Headed | `npm run test-firefox-headed` | `npm run test-chrome-headed` |
105
+ | Headless | `npm run test-firefox-headless` | `npm run test-chrome-headless` |
106
+ | Watch (headed) | `npm run test-firefox-watch` | `npm run test-chrome-watch` |
107
+ | Coverage (headless) | `npm run test-firefox-coverage` | `npm run test-chrome-coverage` |
108
+
109
+ `npm test` invokes `test-firefox-coverage`. These commands set the display mode
110
+ explicitly, independently of `BIMPLUS_HEADLESS`.
111
+
112
+ To run just one test file with Polly, use the browser's task, for example:
113
+
114
+ ```sh
115
+ npx npm-run-all -p -r test-polly-listen-task "test-chrome-task -- --browser.headless=false test/tests/OverlayPollyTests.js"
116
+ ```
117
+
118
+ The Vitest compatibility middleware serves `/data/` from `test/data/` and
119
+ provides the installed `web-ifc` WASM with the correct MIME type, preserving
120
+ the asset routes previously supplied by Karma proxies.
121
+
122
+ Polly replays the checked-in HAR recordings. Older authorization entries have
123
+ sanitized passwords but retain request IDs calculated before sanitization. The
124
+ test helper handles these entries by matching the complete sanitized request
125
+ and request order, without rewriting the recordings. Some legacy recordings
126
+ also omit GLB requests because earlier Karma tests had populated IndexedDB.
127
+ On a geometry replay miss, the helper reuses a recorded GET response for the
128
+ same URL (including model, discipline, revision and all query parameters) and
129
+ request fields from another HAR, ignoring only the authorization token. This
130
+ allows isolated and filtered runs without depending on prior tests' caches.
131
+ Locally, Polly enables `recordIfMissing`, so unmatched requests can fall through
132
+ to the live API and be recorded. In CI, recording is disabled and missing
133
+ recordings fail instead of falling back to the live API. A local login 401
134
+ followed by `Cannot persist response` can therefore indicate a missing or
135
+ unmatched recording rather than an expired recorded token.
136
+
137
+ Modelviewer DDT runs are separate and require the sibling `simple-ddt-server`,
138
+ the selected dataset, and stored reference results:
139
+
140
+ ```sh
141
+ npm run test-modelviewer-ddt
142
+ npm run test-modelviewer-ddt-long
143
+ npm run test-vitest-modelviewer-chrome
144
+ npm run test-vitest-modelviewer-chrome-long
145
+ ```
146
+
147
+ Vitest writes JUnit output under `test-results/`. Firefox Istanbul coverage is
148
+ written under `coverage/`, including `coverage/lcov.info` for CI artifact
149
+ collection. Coverage instruments renderer source under `src/`, excluding
150
+ vendored and generated worker files. Two IFC
151
+ references differ when tested against installed `web-ifc` 0.0.77, while the
152
+ existing references were generated with copied 0.0.75 WASM; the DDT does not
153
+ update reference data automatically. See
154
+ [the migration plan](KARMA_TO_VITEST_MIGRATION_PLAN.md) for remaining gates.
87
155
 
88
156
  ### Documentation
89
157
  Bimplus WebSDK uses npm documentation plugin for easy documentation generation.