From a5c4f010368d64563dd3d0b31bab5162d6a7caec Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 24 Jan 2024 08:22:20 -0800 Subject: [PATCH] Use a raw string for console logging with path (#2177) Fixes #2176 On windows a path can include a `\` followed by a letter that is not a valid escape code in a Dart string. Prefix the string with `r` to make it a raw string and log the path directly. --- pkgs/test/CHANGELOG.md | 7 ++++++- pkgs/test/lib/src/runner/browser/compilers/dart2js.dart | 2 +- pkgs/test/pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index 7aaf6a8d2..2f01de4f1 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md @@ -1,8 +1,13 @@ +## 1.25.2 + +* Fix a bug running browser tests with paths containing windows directory + separator follow by a character which is an invalid Dart string escape + sequence. + ## 1.25.1 * Fix a bug where in precompiled mode, html files for tests were no longer created. - * Support the latest version of `package:js`. * Document the silent reporter in CLI help output. diff --git a/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart b/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart index 6794c645e..2c26ed0ea 100644 --- a/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart +++ b/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart @@ -118,7 +118,7 @@ class Dart2JsSupport extends CompilerSupport with JsHtmlWrapper { import '${await absoluteUri(dartPath)}' as test; void main() { - dom.window.console.log('Startup for test path $dartPath'); + dom.window.console.log(r'Startup for test path $dartPath'); internalBootstrapBrowserTest(() => test.main); } '''; diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index 45035a642..d3c9b7655 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 1.25.1 +version: 1.25.2 description: >- A full featured library for writing and running Dart tests across platforms. repository: https://github.com/dart-lang/test/tree/master/pkgs/test