abner / flutter_js

A Javascript engine to use with flutter. It uses quickjs on Android and JavascriptCore on IOS
MIT License
472 stars 119 forks source link

Flutter js unit test #95

Open runzun1987 opened 2 years ago

runzun1987 commented 2 years ago

I have a flutter test project which depends on futter js (javascript environment), I wrote a unit test for it. But I keep getting errors on this line

jsRuntime = getJavascriptRuntime();

  Invalid argument(s): Failed to load dynamic library 'quickjs_c_bridge.dll': error code 126
    dart:ffi                                                 new DynamicLibrary.open
    package:flutter_js/quickjs/ffi.dart 118:26               _qjsLib
    package:flutter_js/quickjs/ffi.dart                      _qjsLib
    package:flutter_js/quickjs/ffi.dart 163:19               _jsNewRuntime
    package:flutter_js/quickjs/ffi.dart                      _jsNewRuntime
    package:flutter_js/quickjs/ffi.dart 206:14               jsNewRuntime
    package:flutter_js/quickjs/quickjs_runtime2.dart 51:16   QuickJsRuntime2._ensureEngine
    package:flutter_js/quickjs/quickjs_runtime2.dart 165:5   QuickJsRuntime2.evaluate
    package:flutter_js/quickjs/quickjs_runtime2.dart 230:9   QuickJsRuntime2.initChannelFunctions
    package:flutter_js/javascript_runtime.dart 63:5          JavascriptRuntime.init
    package:flutter_js/quickjs/quickjs_runtime2.dart 46:10   new QuickJsRuntime2
    package:flutter_js/flutter_js.dart 40:15    

             getJavascriptRuntime 

I can't figure out how to do the flutter js unit test. I want some tips and if possible In reference, it is written only for windows and Linux but I need it for android apk.If possible with eg:

ashishcors commented 1 year ago

It's mentioned in the readme. Please check this: https://pub.dev/packages/flutter_js#unit-testing-javascript-evaluation