|
| 1 | +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file |
| 2 | +// for details. All rights reserved. Use of this source code is governed by a |
| 3 | +// BSD-style license that can be found in the LICENSE file. |
| 4 | + |
| 5 | +import 'dart:convert'; |
| 6 | +import 'dart:io'; |
| 7 | + |
| 8 | +import 'package:path/path.dart' as p; |
| 9 | +import 'package:pub/src/exit_codes.dart' as exit_codes; |
| 10 | +import 'package:shelf/shelf.dart' as shelf; |
| 11 | +import 'package:test/test.dart'; |
| 12 | + |
| 13 | +import '../descriptor.dart' as d; |
| 14 | +import '../test_pub.dart'; |
| 15 | +import 'utils.dart'; |
| 16 | + |
| 17 | +void main() { |
| 18 | + test( |
| 19 | + 'with --skip-validation dependency resolution and validations are skipped.', |
| 20 | + () async { |
| 21 | + await servePackages(); |
| 22 | + await d.validPackage().create(); |
| 23 | + await d.dir(appPath, [ |
| 24 | + d.validPubspec( |
| 25 | + extras: { |
| 26 | + // Dependency cannot be resolved. |
| 27 | + 'dependencies': {'foo': 'any'} |
| 28 | + }, |
| 29 | + ) |
| 30 | + ]).create(); |
| 31 | + // It is an error to publish without a LICENSE file. |
| 32 | + File(d.path(p.join(appPath, 'LICENSE'))).deleteSync(); |
| 33 | + await d.credentialsFile(globalServer, 'access-token').create(); |
| 34 | + |
| 35 | + await servePackages(); |
| 36 | + var pub = await startPublish(globalServer, args: ['--skip-validation']); |
| 37 | + |
| 38 | + handleUploadForm(globalServer); |
| 39 | + handleUpload(globalServer); |
| 40 | + |
| 41 | + globalServer.expect('GET', '/create', (request) { |
| 42 | + return shelf.Response.ok( |
| 43 | + jsonEncode({ |
| 44 | + 'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} |
| 45 | + }), |
| 46 | + ); |
| 47 | + }); |
| 48 | + await pub.shouldExit(exit_codes.SUCCESS); |
| 49 | + }); |
| 50 | +} |
0 commit comments