From 7b25fcd04cb2a896d09482aa6a0a8ddbde4fbe0b Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 28 Oct 2024 18:34:34 +0100 Subject: [PATCH] =?UTF-8?q?extend=20`@source=20"=E2=80=A6";`=20and=20`sour?= =?UTF-8?q?ce(=E2=80=A6)`=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test now makes sure that: 1. If a glob is used, and it contains `**`, then it should _not_ resolve ignored files/folders like `node_modules`. 2. If an explicit glob is used that contains `node_modules`, then we will resolve files in this folder. 3. If an explicit glob is used, and that glob includes file extensions we normally ignore then those files should resolve because the glob is explicit. --- integrations/cli/index.test.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/integrations/cli/index.test.ts b/integrations/cli/index.test.ts index cd0c20a5d..b1b17eb1a 100644 --- a/integrations/cli/index.test.ts +++ b/integrations/cli/index.test.ts @@ -256,7 +256,7 @@ describe.each([ ) }) -test.only( +test( 'source(…) and `@source` can be configured to use auto source detection (build + watch mode)', { fs: { @@ -291,6 +291,10 @@ test.only( /* Project D should apply auto source detection rules, such as ignoring node_modules */ @source '../../project-d/**/*.{html,js}'; + @source '../../project-d/**/*.bin'; + + /* Same as above, but my-lib-2 _should_ be includes */ + @source '../../project-d/node_modules/my-lib-2/*.{html,js}'; `, // Project A is the current folder, but we explicitly configured @@ -372,12 +376,27 @@ test.only( > `, + // Project D has an explicit glob containing node_modules, thus should include the html file + 'project-d/node_modules/my-lib-2/src/index.html': html` +
+ `, + // Project D should look for files with the extensions html and js. 'project-d/src/index.html': html`
`, + + // Project D should have a binary file even though we ignore binary files + // by default, but it's explicitly listed. + 'project-d/my-binary-file.bin': html` +
+ `, }, }, async ({ fs, exec, spawn, root }) => { @@ -408,6 +427,14 @@ test.only( --tw-content: 'project-c/src/index.html'; content: var(--tw-content); } + .content-\\[\\'project-d\\/my-binary-file\\.bin\\'\\] { + --tw-content: 'project-d/my-binary-file.bin'; + content: var(--tw-content); + } + .content-\\[\\'project-d\\/node_modules\\/my-lib-2\\/src\\/index\\.html\\'\\] { + --tw-content: 'project-d/node modules/my-lib-2/src/index.html'; + content: var(--tw-content); + } .content-\\[\\'project-d\\/src\\/index\\.html\\'\\] { --tw-content: 'project-d/src/index.html'; content: var(--tw-content);