mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix stray --packages argument from workspace refactor; add a test. (#170449)
Closes https://github.com/flutter/flutter/issues/170433.
This commit is contained in:
parent
8d2c80829f
commit
8953ea2cf9
@ -219,7 +219,7 @@ class WebTestCompiler {
|
||||
),
|
||||
'compile',
|
||||
'wasm',
|
||||
'--packages=../../.dart_tool/package_config.json',
|
||||
'--packages=${buildInfo.packageConfigPath}',
|
||||
'--extra-compiler-option=--platform=$platformFilePath',
|
||||
'--extra-compiler-option=--multi-root-scheme=org-dartlang-app',
|
||||
'--extra-compiler-option=--multi-root=${projectDirectory.childDirectory('test').path}',
|
||||
|
||||
@ -94,4 +94,73 @@ void main() {
|
||||
|
||||
expect(processManager.hasRemainingExpectations, isFalse);
|
||||
});
|
||||
|
||||
testUsingContext('web test compiler issues valid compile command (wasm)', () async {
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.file('project/test/fake_test.dart').createSync(recursive: true);
|
||||
fileSystem.file('build/out').createSync(recursive: true);
|
||||
fileSystem.file('build/build/out.sources').createSync(recursive: true);
|
||||
fileSystem.file('build/build/out.json')
|
||||
..createSync()
|
||||
..writeAsStringSync('{}');
|
||||
fileSystem.file('build/build/out.map').createSync();
|
||||
fileSystem.file('build/build/out.metadata').createSync();
|
||||
final FakePlatform platform = FakePlatform(environment: <String, String>{});
|
||||
final Config config = Config(
|
||||
Config.kFlutterSettings,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
platform: platform,
|
||||
);
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
const FakeCommand(
|
||||
command: <Pattern>[
|
||||
'Artifact.engineDartBinary.TargetPlatform.web_javascript',
|
||||
'compile',
|
||||
'wasm',
|
||||
'--packages=.dart_tool/package_config.json',
|
||||
'--extra-compiler-option=--platform=HostArtifact.webPlatformKernelFolder/dart2wasm_platform.dill',
|
||||
'--extra-compiler-option=--multi-root-scheme=org-dartlang-app',
|
||||
'--extra-compiler-option=--multi-root=project/test',
|
||||
'--extra-compiler-option=--multi-root=build',
|
||||
'--extra-compiler-option=--enable-asserts',
|
||||
'--extra-compiler-option=--no-inlining',
|
||||
'-DFLUTTER_WEB_USE_SKIA=true',
|
||||
'-DFLUTTER_WEB_USE_SKWASM=false',
|
||||
'-O0',
|
||||
'-o',
|
||||
'build/main.dart.wasm',
|
||||
'build/main.dart',
|
||||
],
|
||||
stdout: 'result abc\nline0\nline1\nabc\nabc build/out 0',
|
||||
),
|
||||
]);
|
||||
final WebTestCompiler compiler = WebTestCompiler(
|
||||
logger: logger,
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(environment: <String, String>{}),
|
||||
artifacts: Artifacts.test(),
|
||||
processManager: processManager,
|
||||
config: config,
|
||||
);
|
||||
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.debug,
|
||||
'',
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
);
|
||||
|
||||
await compiler.initialize(
|
||||
projectDirectory: fileSystem.directory('project'),
|
||||
testOutputDir: 'build',
|
||||
testFiles: <String>['project/test/fake_test.dart'],
|
||||
buildInfo: buildInfo,
|
||||
webRenderer: WebRendererMode.canvaskit,
|
||||
useWasm: true,
|
||||
);
|
||||
|
||||
expect(processManager.hasRemainingExpectations, isFalse);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user