An open source design system that's fully customizable and agent ready
TypeScript
test(Resizable): load the package root while the file is collected, not inside a timed test (#8471)
Christopher Chedeaucae1f668cb46
diff --git a/packages/core/src/Resizable/utils.test.ts b/packages/core/src/Resizable/utils.test.tsindex 53b3415d0e..8cab6ed3c2 100644--- a/packages/core/src/Resizable/utils.test.ts+++ b/packages/core/src/Resizable/utils.test.ts@@ -3,6 +3,12 @@import {readFileSync} from 'node:fs';import {join} from 'node:path';import {describe, expect, it} from 'vitest';+// The package root loads here, while the file is collected, not inside the+// test that checks it. Loading every Core module takes about 15 s of transform+// on an idle machine. Inside a test, that load ran against the test timeout+// and failed on a loaded machine. No timeout bounds collection.+import * as root from '@astryxdesign/core';+import * as resizableUtils from '@astryxdesign/core/Resizable/utils';import {pixel as tablePixel} from '../Table/utils';import {percent as barrelPercent} from './index';import {percent, pixel} from './utils';@@ -37,19 +43,15 @@ describe('Resizable structured sizing helpers', () => {expect(values).toHaveLength(6);});- it('re-exports Table pixel and percent without a root collision', async () => {- const [module, root] = await Promise.all([- import('@astryxdesign/core/Resizable/utils'),- import('@astryxdesign/core'),- ]);+ it('re-exports Table pixel and percent without a root collision', () => {const source = readFileSync(join(process.cwd(), 'packages/core/src/Resizable/utils.ts'),'utf8',);expect(pixel).toBe(tablePixel);- expect(module.pixel).toBe(tablePixel);- expect(module.percent).toBe(percent);+ expect(resizableUtils.pixel).toBe(tablePixel);+ expect(resizableUtils.percent).toBe(percent);expect(root.pixel).toBe(tablePixel);expect(root.percent).toBe(percent);expect(barrelPercent).toBe(percent);