Skip to content

styled-jsx transform infinite loop #656

Description

Describe the bug

There is an infinite loop when transforming this file with styled-jsx:

Minimal reproduction

Put

export const Probe = (props) => {
  const t = props.theme;
  const Icon = t.icon;
  return (
    <div className="probe">
      <Icon />
      <style jsx>{`
        .probe {
          color: ${t.color};
        }
      `}</style>
    </div>
  );
};

into packages/styled-jsx/transform/tests/fixture/class/input.js

Then you get

> Should transform class correctly
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯


  Snapshots  1 obsolete
             ↳ __tests__/wasm.test.ts
               · Should transform class correctly 1

 Test Files  1 failed (1)
      Tests  1 failed | 2 passed | 78 skipped (81)
   Start at  21:57:39
   Duration  5.43s (transform 23ms, setup 0ms, collect 44ms, tests 5.23s, environment 0ms, prepare 35ms)

This is on commit a93bcc0

Expected behavior

It should be transformed and not timeout

Additional context
vercel/next.js#97685

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions