Skip to content

Commit

Permalink
add analysis format test
Browse files Browse the repository at this point in the history
  • Loading branch information
masa-tokyo committed Dec 7, 2023
1 parent bc48327 commit 39b0df2
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions scripts/bootstrap_package/test/analysis_format_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'dart:io';

import 'package:path/path.dart' as path;
import 'package:test/test.dart';

/// ใ‚ณใƒผใƒ‰ใฎ่ณชใŒๆ‹…ไฟใ•ใ‚Œใฆใ„ใ‚‹ใ‹ใ‚’ใƒ†ใ‚นใƒˆใ™ใ‚‹้–ขๆ•ฐ
///
/// ๆœฌใƒ‘ใƒƒใ‚ฑใƒผใ‚ธๅ†…ใฎๅฎŸ่ฃ…ใซ้š›ใ—ใฆๅ•้กŒใŒ่ตทใ“ใฃใฆใ„ใŸๅ ดๅˆใซไบ‹ๅ‰ใซๆฐ—ใฅใ‘ใ‚‹ใ‚ˆใ†ใซใ€
/// ๅฎŸ้š›ใซใƒ‘ใƒƒใ‚ฑใƒผใ‚ธใ‚’็”Ÿๆˆใ—ใŸไธŠใงใƒ†ใ‚นใƒˆใ‚’ๅฎŸ่กŒใ™ใ‚‹ใ€‚
void main() {
test('Analysis format test', () {
// // ใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใƒซใƒผใƒˆใธ็งปๅ‹•
Directory.current = Directory('../..');

// ไธ€ๆ„ใชๅๅ‰ใฎใƒ‘ใƒƒใ‚ฑใƒผใ‚ธใ‚’็”Ÿๆˆ
final now = DateTime.now().microsecondsSinceEpoch;
final packageName = 'analysis_format_test_$now';
if (Platform.environment['GITHUB_ACTIONS'] == 'true') {
Process.runSync(
'dart',
[
'run',
'bootstrap_package',
packageName,
'-d',
'This is a test package for analysis and format check.',
],
);
} else {
Process.runSync(
'fvm',
[
'dart',
'run',
'bootstrap_package',
packageName,
'-d',
'This is a test package for analysis and format check.',
],
);
}

// ใƒ†ใ‚นใƒˆๅฎŸ่กŒ
Process.runSync('melos', ['run', 'analyze']);
Process.runSync('melos', ['run', 'format']);
Process.runSync(
path.join(
'.github',
'workflows',
'scripts',
'validate-formatting.sh',
),
[],
);

// ็”Ÿๆˆใƒ‘ใƒƒใ‚ฑใƒผใ‚ธใ‚’ๅ‰Š้™ค
Directory(path.join('packages', packageName)).deleteSync(recursive: true);
});
}

0 comments on commit 39b0df2

Please sign in to comment.