(Small) Help needed from DataviewJS experts

Things I have tried

I found this snippet of code that allows me to insert in my Daily Note template all past undone tasks:

dv.header(1, "To-Dos ancora da fare"); 
dv.header(2, "Nelle Daily Notes:"); 
var now = new Date(); 
var today = now.setHours(0,0,0,0); 
dv.taskList(dv.pages().file .where(f => (f.day < today)) 
.sort(f => f.day) 
.tasks.where(t => !t.completed), true); 
dv.header(2, "In altre note:"); 
dv.taskList(dv.pages().file 
.where(f => !f.day) 
.tasks.where(t => !t.completed), true); 

What I’m trying to do

I would like to exclude tasks in some pages (not necessarily in a single folder), and particularly three containing “test” or “Test” in their file name.
Is it possible to add an exclusion like this?

As you can easily understand, I’m not a programmer nor a JS language expert…
Thanks for any help, especially the ones that can make me understand what’s the “magic” behind the command(s)!

To exclude based on some property of the file (like its name), modify the .where right after .file. Here I use a lowercase version of the filename in the comparison so that I don’t have to separately check “test” and “Test”. The ! in front means NOT. So we want files where the name does not include “test” or “Test” and it has a field “day” with a date earlier than today.
dv.pages().file.where(f => !f.name.toLowerCase().includes("test") && (f.day < today))...

Or for the “altre note” query:
dv.pages().file.where(f => !f.day && !f.name.toLowerCase().includes("test"))...

To exclude based on some property of the task, you would use the .where right after .tasks, which is already excluding tasks that are completed. (Do you see how the code is saying that?)

A note about f.day < today: You might want to use the dataview helper function for dates dv.date("today") to make today in that comparison rather than using the Javascript Date().