You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using vitepress's nodejs api, but one problem is that if I call build twice, the second time there will be the wrong cache, causing the built index.html to still be the old result from the first time.
import{mkdir,readFile,writeFile}from'fs/promises'importpathfrom'path'import{build}from'vitepress'import{it,expect}from'vitest'consttempPath=path.resolve(__dirname,'.temp')it('should build',async()=>{awaitmkdir(tempPath,{recursive: true})awaitwriteFile(path.resolve(tempPath,'index.md'),'# test 1')awaitbuild(tempPath,{outDir: path.resolve(tempPath,'dist'),})expect(awaitreadFile(path.resolve(tempPath,'dist/index.html'),'utf-8'),).include('test 1')awaitwriteFile(path.resolve(tempPath,'index.md'),'# test 2')awaitbuild(tempPath,{outDir: path.resolve(tempPath,'dist'),})expect(awaitreadFile(path.resolve(tempPath,'dist/index.html'),'utf-8'),).include('test 2')// AssertionError: expected '<!DOCTYPE html>\n<html lang="en-US" d…' to include 'test 2'})
Describe the bug
I'm using vitepress's nodejs api, but one problem is that if I call build twice, the second time there will be the wrong cache, causing the built index.html to still be the old result from the first time.
Reproduction
git clone https://github.com/rxliuli/vitepress-error-demo
pnpm i
pnpm vitest
Expected behavior
The cache should be cleared during the second build
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: