Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test: three suites pass without the NODE_PATH pnpm's bin shim sets (#10088)

Christopher Chedeau92947d98f759
diff --git a/packages/cli/clients/cli/commands/text-json-parity.test.mjs b/packages/cli/clients/cli/commands/text-json-parity.test.mjs
index ae2809ee32..17c4050c46 100644
--- a/packages/cli/clients/cli/commands/text-json-parity.test.mjs
+++ b/packages/cli/clients/cli/commands/text-json-parity.test.mjs
@@ -425,15 +425,22 @@ const CASES = [
name: 'experimental render',
args: ['experimental', 'render', 'page.jsx'],
cwd: '__TMP__',
- // A page with no imports, in a folder that can resolve React.
+ // A page with no imports, in a folder that can resolve React and Core, so
+ // the page gets Core's stylesheets in every runner.
setup: dir => {
- fs.mkdirSync(path.join(dir, 'node_modules'), {recursive: true});
+ fs.mkdirSync(path.join(dir, 'node_modules', '@astryxdesign'), {
+ recursive: true,
+ });
for (const pkg of ['react', 'react-dom']) {
fs.symlinkSync(
path.join(REPO_ROOT, 'node_modules', pkg),
path.join(dir, 'node_modules', pkg),
);
}
+ fs.symlinkSync(
+ path.join(REPO_ROOT, 'packages', 'core'),
+ path.join(dir, 'node_modules', '@astryxdesign', 'core'),
+ );
fs.writeFileSync(
path.join(dir, 'page.jsx'),
'export default function Page() { return <h1>Hello</h1>; }\n',
diff --git a/packages/core/src/RadioList/RadioListItem.press.source-build.test.mjs b/packages/core/src/RadioList/RadioListItem.press.source-build.test.mjs
index a2d1b1ca71..6e1e3c8ffa 100644
--- a/packages/core/src/RadioList/RadioListItem.press.source-build.test.mjs
+++ b/packages/core/src/RadioList/RadioListItem.press.source-build.test.mjs
@@ -15,6 +15,7 @@
*/
import fs from 'node:fs/promises';
+import {createRequire} from 'node:module';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {transformAsync} from '@babel/core';
@@ -23,6 +24,9 @@ import {describe, expect, it} from 'vitest';
import stylexResolution from '../../../../scripts/stylex-module-resolution.cjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
+// Core declares the presets, so they resolve from here, not from the folder
+// the tests run in.
+const require = createRequire(import.meta.url);
async function compiledCss(fileName) {
const file = path.join(__dirname, fileName);
@@ -31,8 +35,11 @@ async function compiledCss(fileName) {
configFile: false,
filename: file,
presets: [
- ['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
- ['@babel/preset-react', {runtime: 'automatic'}],
+ [
+ require.resolve('@babel/preset-typescript'),
+ {isTSX: true, allExtensions: true},
+ ],
+ [require.resolve('@babel/preset-react'), {runtime: 'automatic'}],
],
plugins: [
[
diff --git a/packages/core/src/Switch/Switch.focusRing.source-build.test.mjs b/packages/core/src/Switch/Switch.focusRing.source-build.test.mjs
index cb53dbaa95..cf6b5a4152 100644
--- a/packages/core/src/Switch/Switch.focusRing.source-build.test.mjs
+++ b/packages/core/src/Switch/Switch.focusRing.source-build.test.mjs
@@ -16,6 +16,7 @@
*/
import fs from 'node:fs/promises';
+import {createRequire} from 'node:module';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {transformAsync} from '@babel/core';
@@ -24,6 +25,9 @@ import {describe, expect, it} from 'vitest';
import stylexResolution from '../../../../scripts/stylex-module-resolution.cjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
+// Core declares the presets, so they resolve from here, not from the folder
+// the tests run in.
+const require = createRequire(import.meta.url);
async function compiledCss(fileName) {
const file = path.join(__dirname, fileName);
@@ -32,8 +36,11 @@ async function compiledCss(fileName) {
configFile: false,
filename: file,
presets: [
- ['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
- ['@babel/preset-react', {runtime: 'automatic'}],
+ [
+ require.resolve('@babel/preset-typescript'),
+ {isTSX: true, allExtensions: true},
+ ],
+ [require.resolve('@babel/preset-react'), {runtime: 'automatic'}],
],
plugins: [
[