-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Huge memory consumption #76
Comments
Does this happen when you run the provided example or when you run all the tests in your app at once? I'm unable to reproduce using the example. |
Will try tomorrow. We have 104 golden test and would increase a lot the number... |
Example consume few giga when copy paste >100 test but not 40g. I need to find where in our app we have the issue. @Kirpal , Is their any practice to absolutely avoid when doing golden test ? Must i cache something ? |
@Kirpal this example use 10go (in our app we used 3 other similar process which increase the total near 40go) import 'package:alchemist/alchemist.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
final List<ThemeMode> modes = <ThemeMode>[ThemeMode.light, ThemeMode.dark];
void goldenForAllThemesAndModes(
void Function(
dynamic flavorConfig,
ThemeMode themeMode,
ThemeData themeData,
)
run,
) {
for (final int index in List<int>.generate(13, (int index) => index)) {
for (final ThemeMode mode in modes) {
final ThemeData themeData =
mode == ThemeMode.light ? ThemeData.light() : ThemeData.dark();
AlchemistConfig.runWithConfig(
config: AlchemistConfig(theme: themeData),
run: () => run(index, mode, themeData),
);
}
}
}
void main() {
setUpAll(() async {
await loadAppFonts();
});
void _textsTest(
dynamic abstractConfig,
ThemeMode mode,
TextTheme textTheme,
) {
goldenTest(
'renders texts correctly',
fileName:
'theme-texts-${abstractConfig.toString().toLowerCase()}-${mode.name}',
builder: () => GoldenTestGroup(
columns: 1,
children: <GoldenTestScenario>[
GoldenTestScenario(
name: 'body text 1',
child: Text(
'Sample text',
style: textTheme.bodyText1,
),
),
GoldenTestScenario(
name: 'body text 2',
child: Text(
'Sample text',
style: textTheme.bodyText2,
),
),
GoldenTestScenario(
name: 'headline 1',
child: Text(
'Sample text',
style: textTheme.headline1,
),
),
GoldenTestScenario(
name: 'headline 2',
child: Text(
'Sample text',
style: textTheme.headline2,
),
),
GoldenTestScenario(
name: 'headline 3',
child: Text(
'Sample text',
style: textTheme.headline3,
),
),
GoldenTestScenario(
name: 'headline 4',
child: Text(
'Sample text',
style: textTheme.headline4,
),
),
GoldenTestScenario(
name: 'headline 5',
child: Text(
'Sample text',
style: textTheme.headline5,
),
),
GoldenTestScenario(
name: 'headline 6',
child: Text(
'Sample text',
style: textTheme.headline6,
),
),
GoldenTestScenario(
name: 'subtitle 1',
child: Text(
'Sample text',
style: textTheme.subtitle1,
),
),
GoldenTestScenario(
name: 'subtitle 2',
child: Text(
'Sample text',
style: textTheme.subtitle2,
),
),
],
),
);
}
group('theme', () {
goldenForAllThemesAndModes(
(
dynamic abstractConfig,
ThemeMode themeMode,
ThemeData themeData,
) {
_textsTest(abstractConfig, themeMode, themeData.textTheme);
},
);
});
}
|
hi @Kirpal, Do you well achieve to reproduce the issue ? |
@Kirpal have you got time to check :'( ? |
Hi @Kirpal , Any update :'( ? |
up |
I think I'm running into the same issue. My reproducible example below. Raw flutter test does not break a sweat. Alchemist version makes my macbook freeze after a few runs.
|
Check on your MacOS |
Oh yes it is |
Is there an existing issue for this?
Version
0.4.1
Description
Our app have many, many golden test like following. The issue is about memory consumption, we are today at 40go every run. Do you know what in golden test took so much memory ? Any general good practice ?
Steps to reproduce
run many golden test
Expected behavior
As less memory as possible
Screenshots
No response
Additional context and comments
No response
The text was updated successfully, but these errors were encountered: