Skip to content
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

Tests fail: Unknown file extension ".tsx" for _layouts/MainLayout.11ty.tsx #3

Open
9999years opened this issue Jan 6, 2025 · 2 comments

Comments

@9999years
Copy link
Contributor

Tests seem to fail, regardless of if I have "@11ty/eleventy": "^3.0.0" in my package.json:

$ npm run test

> [email protected] test
> vitest run


 RUN  v1.6.0 /Users/wiggles/eleventy-tsx

stderr | tests/site.test.ts > should load an Eleventy site
[11ty] Problem writing Eleventy templates:
[11ty] Unknown file extension ".tsx" for /Users/wiggles/eleventy-tsx/_layouts/MainLayout.11ty.tsx (via TypeError)
[11ty]
[11ty] Original error stack trace: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".tsx" for /Users/wiggles/eleventy-tsx/_layouts/MainLayout.11ty.tsx
[11ty]     at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:183:9)
[11ty]     at defaultGetFormat (node:internal/modules/esm/get_format:209:36)
[11ty]     at defaultLoad (node:internal/modules/esm/load:116:22)
[11ty]     at async nextLoad (node:internal/modules/esm/hooks:748:22)
[11ty]     at async Hooks.load (node:internal/modules/esm/hooks:385:20)
[11ty]     at async handleMessage (node:internal/modules/esm/worker:199:18)

 ✓ components/Heading.test.tsx (2)
 ✓ _layouts/MainLayout.test.tsx (1)
 ❯ tests/site.test.ts (1)
   × should load an Eleventy site

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  tests/site.test.ts > should load an Eleventy site
TypeError: Unknown file extension ".tsx" for /Users/wiggles/eleventy-tsx/_layouts/MainLayout.11ty.tsx
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_UNKNOWN_FILE_EXTENSION', __errorAlreadyLogged: true }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed | 2 passed (3)
      Tests  1 failed | 3 passed (4)
   Start at  12:54:32
   Duration  502ms (transform 38ms, setup 0ms, collect 320ms, tests 57ms, environment 279ms, prepare 141ms)
@pauleveritt
Copy link
Owner

Does your eleventy config file have this line that includes .tsx? https://github.com/pauleveritt/eleventy-tsx/blob/main/eleventy.config.ts#L4

@9999years
Copy link
Contributor Author

Yeah, I'm just running the main branch (1960496) with npm i && npm run test.

$ npm --version
11.0.0
$ node --version
v23.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants