Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
extend @source "…"; and source(…) tests
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.
  • Loading branch information
RobinMalfait authored and thecrypticace committed Oct 28, 2024
commit 7b25fcd04cb2a896d09482aa6a0a8ddbde4fbe0b
29 changes: 28 additions & 1 deletion integrations/cli/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ describe.each([
)
})

test.only(
test(
'source(…) and `@source` can be configured to use auto source detection (build + watch mode)',
{
fs: {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -372,12 +376,27 @@ test.only(
></div>
`,

// 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`
<div
class="content-['project-d/node_modules/my-lib-2/src/index.html']"
></div>
`,

// Project D should look for files with the extensions html and js.
'project-d/src/index.html': html`
<div
class="content-['project-d/src/index.html']"
></div>
`,

// 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`
<div
class="content-['project-d/my-binary-file.bin']"
></div>
`,
},
},
async ({ fs, exec, spawn, root }) => {
Expand Down Expand Up @@ -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);
Expand Down