Skip to content
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

Webdev integration_test should not check for string messages that come from pub #2405

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 8 additions & 55 deletions webdev/test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

import 'test_utils.dart';

void main() {
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
var firstSdkVersionWithoutPub = Version(2, 15, 0, pre: '0');

var pubCommand =
sdkVersion.compareTo(firstSdkVersionWithoutPub) < 0 ? 'pub' : 'dart pub';

final testRunner = TestRunner();
setUpAll(testRunner.setUpAll);
tearDownAll(testRunner.tearDownAll);
Expand Down Expand Up @@ -89,10 +81,7 @@ void main() {
var process = await testRunner
.runWebDev([command], workingDirectory: d.sandbox);

await checkProcessStdout(process, [
'webdev could not run for this project.',
'You must have a dependency on `build_runner` in `pubspec.yaml`.'
]);
await checkProcessStdout(process, ['webdev could not run']);
await process.shouldExit(78);
});

Expand All @@ -110,10 +99,7 @@ void main() {
var process = await testRunner
.runWebDev(['serve'], workingDirectory: d.sandbox);

await checkProcessStdout(process, [
'webdev could not run for this project.',
'You must have a dependency on `build_web_compilers` in `pubspec.yaml`.'
]);
await checkProcessStdout(process, ['webdev could not run']);
await process.shouldExit(78);
});

Expand All @@ -137,8 +123,7 @@ void main() {
['serve', '--no-build-web-compilers'],
workingDirectory: d.sandbox);

// Fails since this is a fake package
await process.shouldExit(255);
await process.shouldExit();
});
});

Expand All @@ -150,19 +135,15 @@ void main() {
var webCompilersVersion = _supportedWebCompilersVersion;
var buildDaemonVersion = _supportedBuildDaemonVersion;

late String supportedRange;
switch (entry.key) {
case 'build_runner':
buildRunnerVersion = version;
supportedRange = '^$_supportedBuildRunnerVersion';
break;
case 'build_web_compilers':
webCompilersVersion = version;
supportedRange = '^$_supportedWebCompilersVersion';
break;
case 'build_daemon':
buildDaemonVersion = version;
supportedRange = '^$_supportedBuildDaemonVersion';
}

await d.file('pubspec.yaml', _pubspecYaml).create();
Expand All @@ -183,20 +164,7 @@ void main() {
var process = await testRunner
.runWebDev(['serve'], workingDirectory: d.sandbox);

if (entry.key == 'build_daemon') {
await checkProcessStdout(process, [
'webdev could not run for this project.',
'This version of webdev does not support the `build_daemon`'
]);
} else {
await checkProcessStdout(process, [
'webdev could not run for this project.',
// See https://github.com/dart-lang/linter/issues/965
// ignore: prefer_adjacent_string_concatenation
'The `${entry.key}` version – $version – ' +
'is not within the allowed constraint – $supportedRange.'
]);
}
await checkProcessStdout(process, ['webdev could not run']);

await process.shouldExit(78);
});
Expand All @@ -208,12 +176,7 @@ void main() {
var process =
await testRunner.runWebDev(['serve'], workingDirectory: d.sandbox);

await checkProcessStdout(process, [
'webdev could not run for this project.',
// TODO(https://github.com/dart-lang/webdev/issues/2393): Uncomment
// this line:
// 'Found no `pubspec.yaml` file',
]);
await checkProcessStdout(process, ['webdev could not run']);
await process.shouldExit(78);
});

Expand All @@ -225,13 +188,9 @@ void main() {
var process = await testRunner
.runWebDev(['serve'], workingDirectory: d.sandbox);

await checkProcessStdout(process, [
'webdev could not run for this project.',
'No pubspec.lock file found, please run "$pubCommand get" first.'
]);
await checkProcessStdout(process, ['webdev could not run']);
await process.shouldExit(78);
},
skip: 'https://github.com/dart-lang/webdev/issues/2050',
);

test('should fail if there has been a dependency change', () async {
Expand All @@ -252,15 +211,9 @@ dependencies:
var process =
await testRunner.runWebDev(['serve'], workingDirectory: d.sandbox);

await checkProcessStdout(process, [
'webdev could not run for this project.',
// See https://github.com/dart-lang/linter/issues/965
// ignore: prefer_adjacent_string_concatenation
'The pubspec.yaml file has changed since the pubspec.lock file ' +
'was generated, please run "$pubCommand get" again.'
]);
await checkProcessStdout(process, ['webdev could not run']);
await process.shouldExit(78);
}, skip: 'https://github.com/dart-lang/webdev/issues/2050');
});
});
}
}
Expand Down
Loading