blob: cec8ab0acfe16b2058e5a1911bc04d5a62e3d49f [file] [log] [blame]
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as td;
import '../descriptor.dart' as d;
import '../test_pub.dart';
import 'utils.dart';
/// Describes a package with dot-files in tree.
td.DirectoryDescriptor get validPackageWithDotFiles => d.dir(appPath, [
d.libPubspec('test_pkg', '1.0.0', sdk: '>=1.8.0 <=2.0.0'),
td.dir('.dart_tool', [td.file('package_config.json')]),
td.dir('.github', [td.file('ignored.yml')]),
td.file('LICENSE', 'Eh, do what you want.'),
td.file('', "This package isn't real."),
td.file('', '# 1.0.0\nFirst version\n'),
td.dir('lib', [td.file('test_pkg.dart', 'int i = 1;')])
void main() {
test('Check if package doesn\'t include dot-files', () async {
await servePackages();
await d.credentialsFile(globalServer, 'access token').create();
var pub = await startPublish(globalServer);
await confirmPublish(pub);
globalServer.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
expect(pub.stdout, emits('test_pkg.dart'));
expect(pub.stdout, neverEmits('.dart_tool'));
expect(pub.stdout, neverEmits('.github'));
await pub.shouldExit(exit_codes.SUCCESS);