Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Ability to configure cache folder #305

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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

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