Giter Club home page Giter Club logo

Comments (5)

DorianGrey avatar DorianGrey commented on June 19, 2024 2

I've recently played a bit with a roughly equivalent setup, and it definitely has something to do with the way the tailwind directives are processed.

Playground project: https://github.com/DorianGrey/svelte-ts-playground
Running

pnpm test

Causes the same message as mentioned above.
Commenting this line (which handles the actual import) causes the test to run successfully.

The only alternative option for now seems to be to mock the setup with something empty to prevent it from becoming processed, like:

jest.mock("./src/TailwindSetup.svelte", () => ({}));

Though this does not seem like an optimal solution, at least not for a general case.

Simply speaking - since we're only talking about unit tests, it should be fine to be able to disable the style processing entirely, yet I have not found a way to achieve this for now.

from svelte-jester.

ilyavf avatar ilyavf commented on June 19, 2024 1

Having the same issue. Digging deeper in my case, the package svelte-jester calls child_process.spawnSync. This function has default value for maxBuffer of 1Mb. Setting this to e.g. 10Mb fixes the issue. But the package does not provide API for this.

// https://github.com/mihar-22/svelte-jester/blob/master/src/transformer.js#L15-L17

processed = execSync(`node --unhandled-rejections=strict --abort-on-uncaught-exception "${preprocessor}"`, {
      env: { PATH: process.env.PATH, source, filename, svelteConfig },
      maxBuffer: 1024 * 1024 * 10.       // <<< here set to 10Mb
}).toString()

The workaround by @DorianGrey with mocking the Tailwindcss.svelte worked well for me! Thanks a lot!
Only I had to use a bit different syntax (manual mock creating __mock__ folder)

from svelte-jester.

mihar-22 avatar mihar-22 commented on June 19, 2024 1

If I simply patch the spawned process to have a 10MB maxBuffer will it resolve this issue? I'm not entirely sure how to resolve this issue. Feel free to submit a PR and I'll merge it in ASAP.

from svelte-jester.

mihar-22 avatar mihar-22 commented on June 19, 2024 1

Thanks to @ilyavf this has been fixed in 1.2.0 🎉

from svelte-jester.

ilyavf avatar ilyavf commented on June 19, 2024

As far as I picked up from this node's discussion its OK to set it to 10MB. And this solves the issue with TailwindCSS.

Please see the PR.

from svelte-jester.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.