Skip to content

Commit 3bdd3d1

Browse files
committed
added more information about testing on windows and linux
1 parent 47ff967 commit 3bdd3d1

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

.vscode/launch.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
"name": "flutter_js",
99
"request": "launch",
1010
"type": "dart",
11-
"args": ["--verbose"],
11+
"args": [
12+
"--verbose"
13+
],
1214
"program": "example/lib/main.dart"
1315
},
1416
{
1517
"name": "example",
1618
"cwd": "example",
1719
"request": "launch",
1820
"type": "dart",
19-
"args": ["--verbose"]
21+
"args": [
22+
"--verbose"
23+
]
2024
},
2125
{
2226
"name": "packages",
@@ -28,8 +32,15 @@
2832
"name": "test-with-flutterjs",
2933
"type": "dart",
3034
"program": "test/flutter_js_test.dart",
31-
"env": {
32-
"PATH": "${env:Path};${workspaceFolder}\\example\\build\\windows\\runner\\Debug"
35+
"windows": {
36+
"env": {
37+
"PATH": "${env:Path};${workspaceFolder}\\example\\build\\windows\\runner\\Debug"
38+
}
39+
},
40+
"linux": {
41+
"env": {
42+
"LIBQUICKJSC_TEST_PATH": "${workspaceFolder}/example/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so"
43+
}
3344
},
3445
"request": "launch"
3546
}

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,24 +314,40 @@ With the library being compiled and published to jitpack, applications using the
314314

315315
We can unit test evaluation of expressions on flutter_js using the desktop platforms (windows, linux and macos).
316316

317-
For `Windows` environment you need to build the executable first, and after you need to add the
318-
path `build\windows\runner\Debug` (the absolute path) to your environment path.
317+
For `Windows` and `Linux` you need to build your app Desktop executable first: `flutter build -d windows` or `flutter build -d linux`.
318+
319+
On Windows, after build your application for the first time, at least, add the path `build\windows\runner\Debug` (the absolute path) to your environment path.
319320

320321
In powershell, just run `$env:path += ";${pwd}\build\windows\runner\Debug"`. Now you can run the test in the command line session where you added the `\build\windows\runner\Debug` into the path.
321322

322-
To run the test integrated Visual Studio Code, you will need to setup a launcher to the .vscode/launch.json
323-
so you can fill-in the build folder into the PATH:
323+
For `Linux` you need to exports an environment variable called `LIBQUICKJSC_TEST_PATH` pointing to `build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so`. eg: `export LIBQUICKJSC_TEST_PATH="$PWD/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so"`
324+
325+
326+
To run the test integrated Visual Studio Code, you will need to setup a launcher to the `.vscode/launch.json` file,
327+
so you can fill-in the build folder into the `PATH` on Windows and the `LIBQUICKJSC_TEST_PATH` for linux:
324328

325329
```json
330+
{
331+
"version": "0.2.0",
332+
"configurations": [
326333
{
327334
"name": "test-with-flutterjs",
328335
"type": "dart",
329336
"program": "test/flutter_js_test.dart",
330-
"env": {
331-
"PATH": "${env:Path};${workspaceFolder}\\build\\windows\\runner\\Debug"
337+
"windows": {
338+
"env": {
339+
"PATH": "${env:Path};${workspaceFolder}\\example\\build\\windows\\runner\\Debug"
340+
}
341+
},
342+
"linux": {
343+
"env": {
344+
"LIBQUICKJSC_TEST_PATH": "${workspaceFolder}/example/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so"
345+
}
332346
},
333347
"request": "launch"
334348
}
349+
]
350+
}
335351
```
336352

337-
> For MacOSx and Linux no extra step is needed.
353+
> For running unit tests on MacOSx no extra step is needed.

lib/quickjs/ffi.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ final DynamicLibrary _qjsLib = Platform.environment['FLUTTER_TEST'] == 'true'
118118
? DynamicLibrary.open('quickjs_c_bridge.dll')
119119
: Platform.isMacOS
120120
? DynamicLibrary.process()
121-
: DynamicLibrary.open(Platform.environment['LIBQUICKJSC_PATH'] ??
121+
: DynamicLibrary.open(Platform.environment['LIBQUICKJSC_TEST_PATH'] ??
122122
'libquickjs_c_bridge_plugin.so'))
123123
: (Platform.isWindows
124124
? DynamicLibrary.open('quickjs_c_bridge.dll')

0 commit comments

Comments
 (0)