Skip to content

Conversation

@srosato
Copy link
Contributor

@srosato srosato commented Sep 16, 2023

Summary/ Motivation (TLDR;)

Now possible to specify cache folder by either

  • using preview.debug({cacheFolder: 'your-cache-folder'})
  • automatically with the auto preview feature.

Related issues

Features

  • Specify cache folder for the debug function
  • Specify cache folder for the jestPreviewConfigure

Fixes

  • Running single tests with IDE such as WebStorm/IntelliJ and having the html output being stored at one place instead of relative to the closest jest config it can find.

Chores

  • I ran prettier + eslint and it fixed files outside this PR scope

Usage

Take a look at examples/nextjs-nx/apps/app/jest.config.js, examples/nextjs-nx/apps/app/jest.setup.ts and examples/nextjs-nx/apps/app/specs/index.spec.tsx.

Basically:

For auto-preview

jestPreviewConfigure({
  autoPreview: true,
  cacheFolder: 'path-to-custom-cache-folder',
});

Using debug

// it is best to create a utility file so we do not have to specify it each time we import `debug`

import preview from "jest-preview";

export const debug = () => {
  preview.debug({cacheFolder: 'path-to-custom-cache-folder'});
};

@netlify
Copy link

netlify bot commented Sep 16, 2023

Deploy Preview for jest-preview-library ready!

Name Link
🔨 Latest commit a5db952
🔍 Latest deploy log https://app.netlify.com/sites/jest-preview-library/deploys/6505f41b5915190008b4b0f7
😎 Deploy Preview https://deploy-preview-305--jest-preview-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Sep 16, 2023

Deploy Preview for jest-preview-chinese ready!

Name Link
🔨 Latest commit a5db952
🔍 Latest deploy log https://app.netlify.com/sites/jest-preview-chinese/deploys/6505f41b16027800076e318a
😎 Deploy Preview https://deploy-preview-305--jest-preview-chinese.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@srosato
Copy link
Contributor Author

srosato commented Sep 16, 2023

Main branch seems to break also on Jest Preview Ecosystem CI / build, not sure how to resolve

@srosato
Copy link
Contributor Author

srosato commented Feb 14, 2025

@nvh95 I wonder what you think about this feature? Is anything more needed? Let me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant