2017-07-06 23:40:45 +02:00
|
|
|
// Copyright 2017 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
2017-12-08 02:18:34 +01:00
|
|
|
import 'package:sass/src/io.dart';
|
|
|
|
|
2017-07-06 23:40:45 +02:00
|
|
|
/// Ensures that the NPM package is compiled and up-to-date.
|
|
|
|
///
|
2017-10-21 01:56:54 +02:00
|
|
|
/// This is safe to call even outside the Dart VM.
|
2019-05-31 17:01:49 +02:00
|
|
|
Future<void> ensureNpmPackage() async {
|
2017-12-08 02:18:34 +01:00
|
|
|
// spawnHybridUri() doesn't currently work on Windows and Node due to busted
|
|
|
|
// path handling in the SDK.
|
|
|
|
if (isNode && isWindows) return;
|
|
|
|
|
2020-02-20 07:42:33 +01:00
|
|
|
var channel = spawnHybridCode("""
|
|
|
|
import 'package:cli_pkg/testing.dart' as pkg;
|
|
|
|
import 'package:stream_channel/stream_channel.dart';
|
|
|
|
|
2021-04-09 22:19:35 +02:00
|
|
|
void hybridMain(StreamChannel<Object?> channel) async {
|
2020-02-20 07:42:33 +01:00
|
|
|
pkg.ensureExecutableUpToDate("sass", node: true);
|
|
|
|
channel.sink.close();
|
|
|
|
}
|
|
|
|
""");
|
2017-12-08 02:18:34 +01:00
|
|
|
await channel.stream.toList();
|
2017-07-06 23:40:45 +02:00
|
|
|
}
|