-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(coverage): support --changed
option
#5314
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(coverage): support --changed
option
#5314
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
// Make sure file is not served from cache | ||
// so that instrumenter loads up requested file coverage | ||
if (this.ctx.vitenode.fetchCache.has(filename)) | ||
this.ctx.vitenode.fetchCache.delete(filename) | ||
|
||
await this.ctx.vitenode.transformRequest(filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this wasn't working as I expected it to. Files were served from Vite's cache when vite-node
's fetchCache
was cleared. This came up only with --changed
flag as core.ts
already loaded those files.
Minimal repro using vite-node
:
import { createServer } from "vite";
import { ViteNodeServer } from "vite-node/server";
const server = await createServer({
plugins: [
{
name: "logger",
transform(code, id) {
console.log(`[transform] ${id}`);
},
},
],
});
await server.pluginContainer.buildStart({});
const node = new ViteNodeServer(server);
// Should log [transform] ✅
console.log("transformRequest #1");
await node.transformRequest("./example.ts");
// Should log NOT [transform] ✅
console.log("transformRequest #2");
await node.transformRequest("./example.ts");
// Should log [transform] but it doesn't ❌
console.log("transformRequest #3");
node.fetchCache.clear();
node.fetchCaches.ssr.clear();
node.fetchCaches.web.clear();
await node.transformRequest("./example.ts");
node.server.close();
ddf24af
to
149714f
Compare
149714f
to
8761e80
Compare
Description
I think I'll leave this part out of this PR now: #5237 (comment). That requires some discussion as it changes functionality of
--changed
quite much.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.