File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ scripts:
31
31
32
32
test :
33
33
description : Run tests in a specific package.
34
- run : dart test
34
+ run : flutter test
35
35
exec :
36
36
concurrency : 1
37
37
packageFilters :
Original file line number Diff line number Diff line change @@ -79,13 +79,22 @@ class PowerSyncOpenFactory extends DefaultSqliteOpenFactory {
79
79
}
80
80
81
81
void enableExtension () {
82
- var powersyncLib = Platform .isIOS || Platform .isMacOS
83
- ? DynamicLibrary .process ()
84
- : DynamicLibrary .open (getLibraryForPlatform ());
82
+ var powersyncLib = _getDynamicLibraryForPlatform ();
85
83
sqlite.sqlite3.ensureExtensionLoaded (
86
84
SqliteExtension .inLibrary (powersyncLib, 'sqlite3_powersync_init' ));
87
85
}
88
86
87
+ /// Returns the dynamic library for the current platform.
88
+ DynamicLibrary _getDynamicLibraryForPlatform () {
89
+ /// When running tests, we need to load the library for all platforms.
90
+ if (Platform .environment.containsKey ('FLUTTER_TEST' )) {
91
+ return DynamicLibrary .open (getLibraryForPlatform ());
92
+ }
93
+ return (Platform .isIOS || Platform .isMacOS)
94
+ ? DynamicLibrary .process ()
95
+ : DynamicLibrary .open (getLibraryForPlatform ());
96
+ }
97
+
89
98
void setupFunctions (sqlite.Database db) {
90
99
db.createFunction (
91
100
functionName: 'powersync_sleep' ,
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ class TestOpenFactory extends PowerSyncOpenFactory {
35
35
sqlite_open.open.overrideFor (sqlite_open.OperatingSystem .linux, () {
36
36
return DynamicLibrary .open ('libsqlite3.so.0' );
37
37
});
38
+ sqlite_open.open.overrideFor (sqlite_open.OperatingSystem .macOS, () {
39
+ return DynamicLibrary .open ('libsqlite3.dylib' );
40
+ });
38
41
return super .open (options);
39
42
}
40
43
You can’t perform that action at this time.
0 commit comments