Using nuxt/content in test file without Nuxt instance
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v17.9.1
- Nuxt Version:
3.0.0-rc.4
- Package Manager:
yarn@1.22.17
- Builder:
vite
- User Config:
modules
,experimental
,components
,colorMode
- Runtime Modules:
@nuxtjs/tailwindcss@5.1.3
,@nuxt/content@2.0.1
,@vueuse/nuxt@8.9.1
,@pinia/nuxt@0.1.9
,@nuxtjs/color-mode@3.1.4
- Build Modules:
-
Reproduction
i want replace this method with nuxt/content find() https://github.com/double-slash-podcast/website/blob/efd97318601f47a4379509780c8ddfcce76bd03b/__tests__/guid-episodes.test.ts#L42
Describe the bug
I can’t use nuxt/content in my test file. When i import content, it’s mendatory to init content with all options and one instance of nuxt app. But i haven’t nuxt app in my test. My question is : it’s possible to use nuxt/content outiside nuxt app ?
Additional context
import Content from '@nuxt/content'
const content = Content({...lot of options}, nuxt instance);
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Fetching content - Nuxt Content
Learn how to fetch your static content with $content in your Nuxt.js project. ... $content instance, meaning that you can access it anywhere...
Read more >support for unit testing in a nuxt environment #2465 - GitHub
Describe the feature Unit testing (e.g. [parts of ]composables or server functions) doesn't require a full built of nuxt.
Read more >Component testing in Nuxt.js with Jest - LogRocket Blog
In this article, we'll learn how to set up a game store application with Nuxt.js and test its components. To follow along with...
Read more >@nuxt/content examples - CodeSandbox
Learn how to use @nuxt/content by viewing and forking example apps that make use of @nuxt/content on CodeSandbox. ... Nuxt Content + TailwindCSS...
Read more >How To Easily Create a Blog With Nuxt Content - Telerik
The Nuxt Content module acts as a Git-based headless CMS. You can create blog posts in the form of markdown files inside the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yeah thanks, it’s better. It’s difficult to find the good params for query but it works. 👍🏼 https://github.com/double-slash-podcast/website/blob/7ce57b088ece8cb1dc9ae14319765dc4d9433a12/__tests__/guid-episodes.test.ts#L44
Ok since you have the server, you need to use
$fetch
function from test utils and call thequery
API.