Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"android": "react-native run-android --no-packager --active-arch-only",
"ios": "react-native run-ios --no-packager",
"pod-install": "cd ios && pod install",
"mocha-and-metro": "mocha-remote --exit-on-error -- node --run metro",
"test:android": "mocha-remote --exit-on-error -- concurrently --kill-others-on-fail --passthrough-arguments npm:metro 'npm:android -- {@}' --",
"test:android:allTests": "MOCHA_REMOTE_CONTEXT=allTests node --run test:android -- ",
"test:android:nodeAddonExamples": "MOCHA_REMOTE_CONTEXT=nodeAddonExamples node --run test:android -- ",
Expand Down
12 changes: 12 additions & 0 deletions packages/node-tests/rolldown.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ function testSuiteConfig(suitePath: string): RolldownOptions[] {
delimiters: ["", ""],
},
),
replacePlugin(
{
// Replace the default export to return a function instead of initializing the addon immediately
// This allows the test runner to intercept any errors which would normally be thrown when importing
// to work around Metro's `guardedLoadModule` swallowing errors during module initialization
// See https://github.com/facebook/metro/blob/34bb8913ec4b5b02690b39d2246599faf094f721/packages/metro-runtime/src/polyfills/require.js#L348-L353
"export default require_test();": "export default require_test;",
},
{
delimiters: ["", ""],
},
),
aliasPlugin({
entries: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/node-tests/scripts/generate-entrypoint.mts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function suiteToString(suite: TestSuite, indent = 1): string {
return Object.entries(suite)
.map(([key, value]) => {
if (typeof value === "string") {
return `${padding}"${key}": () => require("./${value}")`;
return `${padding}"${key}": require("./${value}")`;
} else {
return `${padding}"${key}": {\n${suiteToString(
value,
Expand Down
Loading