@chromatic-com/vitest 0.0.1 → 0.0.2-3e7b79a-20260417062346

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 (2) hide show
  1. package/dist/plugin.js +13 -4
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -4092,14 +4092,23 @@ function createCommands(options) {
4092
4092
  for (const [name, domSnapshot] of sessionSnapshots) {
4093
4093
  snapshotBuffers[name] = Buffer.from(JSON.stringify(domSnapshot));
4094
4094
  }
4095
+ const frame = await context.frame();
4096
+ const frameElement = await frame.frameElement();
4097
+ const viewport = await frameElement.evaluate((iframe) => {
4098
+ const computedStyles = iframe.parentElement?.computedStyleMap();
4099
+ return {
4100
+ width: parseInt(computedStyles?.get("width")?.toString() || "1920px", 10),
4101
+ height: parseInt(computedStyles?.get("height")?.toString() || "1080px", 10)
4102
+ };
4103
+ });
4104
+ console.log({
4105
+ viewport
4106
+ });
4095
4107
  await writeTestResult({
4096
4108
  outputDir: resolve(context.project.config.root, options.outputDirectory),
4097
4109
  pageUrl: context.page.url(),
4098
4110
  titlePath: getNames(entity),
4099
- viewport: context.page.viewportSize() || {
4100
- width: 1920,
4101
- height: 1080
4102
- }
4111
+ viewport
4103
4112
  }, snapshotBuffers, archive, {
4104
4113
  delay: options.delay,
4105
4114
  diffIncludeAntiAliasing: options.diffIncludeAntiAliasing,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromatic-com/vitest",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-3e7b79a-20260417062346",
4
4
  "description": "Chromatic Visual Regression Testing for Vitest",
5
5
  "repository": {
6
6
  "type": "git",