Skip to content

Commit 47ff967

Browse files
committed
added tests for js evaluation
1 parent 3e61645 commit 47ff967

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

.vscode/launch.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
"cwd": "packages",
2424
"request": "launch",
2525
"type": "dart"
26+
},
27+
{
28+
"name": "test-with-flutterjs",
29+
"type": "dart",
30+
"program": "test/flutter_js_test.dart",
31+
"env": {
32+
"PATH": "${env:Path};${workspaceFolder}\\example\\build\\windows\\runner\\Debug"
33+
},
34+
"request": "launch"
2635
}
2736
]
2837
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.4.0+3
2+
3+
- Fixed dynamic library load for tests
4+
- Added info about tests into the [README.md](README.md)
5+
16
# 0.4.0+2
27
- Updated README.md with information about github repository containing the C bridge used on
38
Windows and Linux

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,31 @@ We just separated the code to allow build it and in this repository we have only
307307

308308
The library wrapper, both QuickJS and JavascriptCore, are also compiled in a separated repository: https://github.com/fast-development/android-js-runtimes
309309

310-
With the library being compiled and published to jitpack, applications using the wrappers, through flutter_js does not need to compile the shared library using Android NDK.
310+
With the library being compiled and published to jitpack, applications using the wrappers, through flutter_js does not need to compile the shared library using Android NDK.
311+
312+
313+
## Unit Testing javascript evaluation
314+
315+
We can unit test evaluation of expressions on flutter_js using the desktop platforms (windows, linux and macos).
316+
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.
319+
320+
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.
321+
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:
324+
325+
```json
326+
{
327+
"name": "test-with-flutterjs",
328+
"type": "dart",
329+
"program": "test/flutter_js_test.dart",
330+
"env": {
331+
"PATH": "${env:Path};${workspaceFolder}\\build\\windows\\runner\\Debug"
332+
},
333+
"request": "launch"
334+
}
335+
```
336+
337+
> For MacOSx and Linux no extra step is needed.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ packages:
7575
path: ".."
7676
relative: true
7777
source: path
78-
version: "0.4.0+2"
78+
version: "0.4.0+3"
7979
flutter_test:
8080
dependency: "direct dev"
8181
description: flutter

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_js
22
description: A Javascript engine to use with flutter.
33
It uses Quickjs on Android and JavascriptCore on IOS
4-
version: 0.4.0+2
4+
version: 0.4.0+3
55
homepage: https://github.com/abner/flutter_js
66
repository: https://github.com/abner/flutter_js
77

test/flutter_js_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/services.dart';
2-
import 'package:flutter_test/flutter_test.dart';
32
import 'package:flutter_js/flutter_js.dart';
3+
import 'package:flutter_test/flutter_test.dart';
44

55
void main() {
66
const MethodChannel channel = MethodChannel('flutter_js');

0 commit comments

Comments
 (0)