bvaughn / react-virtualized-auto-sizer

Standalone version of the AutoSizer component from react-virtualized
MIT License
613 stars 82 forks source link

Switch to Preconstruct #61

Closed Andarist closed 1 year ago

bvaughn commented 1 year ago

Thank you! 🙇🏼

bvaughn commented 1 year ago

I think this change broke the test target:

    Details:

    /Users/bvaughn/Documents/git/oss/react-virtualized-auto-sizer/src/vendor/detectElementResize.js:285
    export { createDetectElementResize };
    ^^^^^^

    SyntaxError: Unexpected token 'export'

      1 | import { Component, createElement, CSSProperties, ReactElement } from "react";
      2 |
    > 3 | import {
        | ^
      4 |   createDetectElementResize,
      5 |   DetectElementResize,
      6 | } from "./vendor/detectElementResize";

      at Runtime.createScriptFromCode (node_modules/.pnpm/jest-runtime@29.5.0/node_modules/jest-runtime/build/index.js:1495:14)
      at Object.<anonymous> (src/AutoSizer.ts:3:1)
      at Object.<anonymous> (src/AutoSizer.test.tsx:8:1)

My bad for not having tests run on PRs for this project 💩

Andarist commented 1 year ago

I will look into this soon

bvaughn commented 1 year ago

This fixes it:

diff --git a/jest.config.js b/jest.config.js
index bd9f347..5352e83 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,5 +1,15 @@
 /** @type {import('ts-jest').JestConfigWithTsJest} */
 module.exports = {
+  globals: {
+    "ts-jest": {
+      tsconfig: {
+        allowJs: true,
+      },
+    },
+  },
   preset: "ts-jest",
   testMatch: ["**/*.test.{ts,tsx}"],
+  transform: {
+    "^.+\\.[tj]sx?$": "ts-jest",
+  },
 };
bvaughn commented 1 year ago

Published in 1.0.19