File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
test/tests/unexpected-import Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,12 @@ export function bindImportFunction(
159
159
importObjectKeyPathToFunction
160
160
) ;
161
161
if ( ! importedFunctionDescriptor ) {
162
- throw Error ( `Unknown function ${ importObjectKeyPathToFunction . join ( "." ) } ` ) ;
162
+ console . warn (
163
+ `Unexpected function ${ importObjectKeyPathToFunction . join (
164
+ "."
165
+ ) } on import object, using pass-through.`
166
+ ) ;
167
+ return importedFunction ;
163
168
}
164
169
165
170
// Grab type converter functions according to the type descriptor
Original file line number Diff line number Diff line change
1
+ export function thing ( ) : i8 {
2
+ return - 1 ;
3
+ }
Original file line number Diff line number Diff line change
1
+ describe ( "as-bind" , function ( ) {
2
+ it ( "should handle unexpected imports gracefully" , async function ( ) {
3
+ const instance = await AsBind . instantiate ( this . rawModule , {
4
+ env : {
5
+ someFunc ( ) { }
6
+ }
7
+ } ) ;
8
+ assert ( instance . exports . thing ( ) === - 1 ) ;
9
+ } ) ;
10
+ } ) ;
You can’t perform that action at this time.
0 commit comments