Sean Robertson

Sean Robertson

1621909899

Chrome 91 - What’s New in DevTools

New to DevTools in Chrome 91:

What’s new in DevTools (Chrome 91) → https://goo.gle/3eLof2N

Memory inspector → https://goo.gle/349mLZY

You’re not seeing double! We published this episode in English and in Jecelyn’s mother language Mandarin as part of our Mother Language Day series.

Tweet us → https://goo.gle/38mi9Ay

What’s New in DevTools → https://goo.gle/2MeR5Kx
Subscribe to Google Chrome Developers → http://goo.gl/LLLNvf

#devtools #chrome #google-chrome

What is GEEK

Buddha Community

Chrome 91 - What’s New in DevTools
Mike  Kozey

Mike Kozey

1656151740

Test_cov_console: Flutter Console Coverage Test

Flutter Console Coverage Test

This small dart tools is used to generate Flutter Coverage Test report to console

How to install

Add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dev_dependencies:
  test_cov_console: ^0.2.2

How to run

run the following command to make sure all flutter library is up-to-date

flutter pub get
Running "flutter pub get" in coverage...                            0.5s

run the following command to generate lcov.info on coverage directory

flutter test --coverage
00:02 +1: All tests passed!

run the tool to generate report from lcov.info

flutter pub run test_cov_console
---------------------------------------------|---------|---------|---------|-------------------|
File                                         |% Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------------------|---------|---------|---------|-------------------|
lib/src/                                     |         |         |         |                   |
 print_cov.dart                              |  100.00 |  100.00 |   88.37 |...,149,205,206,207|
 print_cov_constants.dart                    |    0.00 |    0.00 |    0.00 |    no unit testing|
lib/                                         |         |         |         |                   |
 test_cov_console.dart                       |    0.00 |    0.00 |    0.00 |    no unit testing|
---------------------------------------------|---------|---------|---------|-------------------|
 All files with unit testing                 |  100.00 |  100.00 |   88.37 |                   |
---------------------------------------------|---------|---------|---------|-------------------|

Optional parameter

If not given a FILE, "coverage/lcov.info" will be used.
-f, --file=<FILE>                      The target lcov.info file to be reported
-e, --exclude=<STRING1,STRING2,...>    A list of contains string for files without unit testing
                                       to be excluded from report
-l, --line                             It will print Lines & Uncovered Lines only
                                       Branch & Functions coverage percentage will not be printed
-i, --ignore                           It will not print any file without unit testing
-m, --multi                            Report from multiple lcov.info files
-c, --csv                              Output to CSV file
-o, --output=<CSV-FILE>                Full path of output CSV file
                                       If not given, "coverage/test_cov_console.csv" will be used
-t, --total                            Print only the total coverage
                                       Note: it will ignore all other option (if any), except -m
-p, --pass=<MINIMUM>                   Print only the whether total coverage is passed MINIMUM value or not
                                       If the value >= MINIMUM, it will print PASSED, otherwise FAILED
                                       Note: it will ignore all other option (if any), except -m
-h, --help                             Show this help

example run the tool with parameters

flutter pub run test_cov_console --file=coverage/lcov.info --exclude=_constants,_mock
---------------------------------------------|---------|---------|---------|-------------------|
File                                         |% Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------------------|---------|---------|---------|-------------------|
lib/src/                                     |         |         |         |                   |
 print_cov.dart                              |  100.00 |  100.00 |   88.37 |...,149,205,206,207|
lib/                                         |         |         |         |                   |
 test_cov_console.dart                       |    0.00 |    0.00 |    0.00 |    no unit testing|
---------------------------------------------|---------|---------|---------|-------------------|
 All files with unit testing                 |  100.00 |  100.00 |   88.37 |                   |
---------------------------------------------|---------|---------|---------|-------------------|

report for multiple lcov.info files (-m, --multi)

It support to run for multiple lcov.info files with the followings directory structures:
1. No root module
<root>/<module_a>
<root>/<module_a>/coverage/lcov.info
<root>/<module_a>/lib/src
<root>/<module_b>
<root>/<module_b>/coverage/lcov.info
<root>/<module_b>/lib/src
...
2. With root module
<root>/coverage/lcov.info
<root>/lib/src
<root>/<module_a>
<root>/<module_a>/coverage/lcov.info
<root>/<module_a>/lib/src
<root>/<module_b>
<root>/<module_b>/coverage/lcov.info
<root>/<module_b>/lib/src
...
You must run test_cov_console on <root> dir, and the report would be grouped by module, here is
the sample output for directory structure 'with root module':
flutter pub run test_cov_console --file=coverage/lcov.info --exclude=_constants,_mock --multi
---------------------------------------------|---------|---------|---------|-------------------|
File                                         |% Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------------------|---------|---------|---------|-------------------|
lib/src/                                     |         |         |         |                   |
 print_cov.dart                              |  100.00 |  100.00 |   88.37 |...,149,205,206,207|
lib/                                         |         |         |         |                   |
 test_cov_console.dart                       |    0.00 |    0.00 |    0.00 |    no unit testing|
---------------------------------------------|---------|---------|---------|-------------------|
 All files with unit testing                 |  100.00 |  100.00 |   88.37 |                   |
---------------------------------------------|---------|---------|---------|-------------------|
---------------------------------------------|---------|---------|---------|-------------------|
File - module_a -                            |% Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------------------|---------|---------|---------|-------------------|
lib/src/                                     |         |         |         |                   |
 print_cov.dart                              |  100.00 |  100.00 |   88.37 |...,149,205,206,207|
lib/                                         |         |         |         |                   |
 test_cov_console.dart                       |    0.00 |    0.00 |    0.00 |    no unit testing|
---------------------------------------------|---------|---------|---------|-------------------|
 All files with unit testing                 |  100.00 |  100.00 |   88.37 |                   |
---------------------------------------------|---------|---------|---------|-------------------|
---------------------------------------------|---------|---------|---------|-------------------|
File - module_b -                            |% Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------------------|---------|---------|---------|-------------------|
lib/src/                                     |         |         |         |                   |
 print_cov.dart                              |  100.00 |  100.00 |   88.37 |...,149,205,206,207|
lib/                                         |         |         |         |                   |
 test_cov_console.dart                       |    0.00 |    0.00 |    0.00 |    no unit testing|
---------------------------------------------|---------|---------|---------|-------------------|
 All files with unit testing                 |  100.00 |  100.00 |   88.37 |                   |
---------------------------------------------|---------|---------|---------|-------------------|

Output to CSV file (-c, --csv, -o, --output)

flutter pub run test_cov_console -c --output=coverage/test_coverage.csv

#### sample CSV output file:
File,% Branch,% Funcs,% Lines,Uncovered Line #s
lib/,,,,
test_cov_console.dart,0.00,0.00,0.00,no unit testing
lib/src/,,,,
parser.dart,100.00,100.00,97.22,"97"
parser_constants.dart,100.00,100.00,100.00,""
print_cov.dart,100.00,100.00,82.91,"29,49,51,52,171,174,177,180,183,184,185,186,187,188,279,324,325,387,388,389,390,391,392,393,394,395,398"
print_cov_constants.dart,0.00,0.00,0.00,no unit testing
All files with unit testing,100.00,100.00,86.07,""

Installing

Use this package as an executable

Install it

You can install the package from the command line:

dart pub global activate test_cov_console

Use it

The package has the following executables:

$ test_cov_console

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add test_cov_console

With Flutter:

 $ flutter pub add test_cov_console

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  test_cov_console: ^0.2.2

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:test_cov_console/test_cov_console.dart';

example/lib/main.dart

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Author: DigitalKatalis
Source Code: https://github.com/DigitalKatalis/test_cov_console 
License: BSD-3-Clause license

#flutter #dart #test 

Sean Robertson

Sean Robertson

1621909899

Chrome 91 - What’s New in DevTools

New to DevTools in Chrome 91:

What’s new in DevTools (Chrome 91) → https://goo.gle/3eLof2N

Memory inspector → https://goo.gle/349mLZY

You’re not seeing double! We published this episode in English and in Jecelyn’s mother language Mandarin as part of our Mother Language Day series.

Tweet us → https://goo.gle/38mi9Ay

What’s New in DevTools → https://goo.gle/2MeR5Kx
Subscribe to Google Chrome Developers → http://goo.gl/LLLNvf

#devtools #chrome #google-chrome

David Loffer

David Loffer

1630032436

Chrome 93 - What’s New in DevTools

Editable CSS container queries, web bundle preview, better string handling in the Console and more.

Editable CSS container queries in the Styles pane

You can now view and edit CSS container queries in the Styles pane.

Container queries provide a much more dynamic approach to responsive design. The @container at-rule works in a similar way to a media query with @media. However, instead of querying the viewport and user agent for information, @container queries the ancestor container that matches certain criteria.

In the Elements panel, click on a DOM element with @container at-rule, DevTools now displays the @container information in the Styles pane. Click on it to edit the size. The Styles pane displays the corresponding container information too. Hover on it to highlight the container element on the page and check the container size. Click on it to select the container element.

The container queries feature is experimental currently. Please turn on the #enable-container-queries flag under chrome://flags to test it.

Editable CSS container queries in the Styles pane

Chromium issue: 1146422

Web bundle preview in the Network panel

Web bundle is a file format for encapsulating one or more HTTP resources in a single file. You can now preview the web bundle content in the Network panel.

The web bundle feature is experimental currently. Please enable #enable-experimental-web-platform-features flag under chrome://flags to test it.

web bundle preview

Chromium issue: 1182537

Attribution Reporting API debugging

Attribution Reporting API errors are now reported in the Issues tab.

Attribution Reporting is a new API to help you measure when a user action (such as an ad click or view) leads to a conversion, without using cross-site identifiers.

Attribution Reporting API errors in the Issues tab

Chromium issue: 1190735

Better string handling in the Console

New context menu in the Console allows you to copy any string in as content, JavaScript literal or JSON literal.

New context menu in the Console

In Chrome 90, DevTools updated the Console to always format string outputs as valid JSON literals. We received feedback from the developers that this change could be confusing, some feel that the amount of escaping is excessive and makes the output unreadable.

The Console now formats string outputs as valid JavaScript litera, and furthermore provides you 3 copy string options. The Copy as JavaScript literal option will escape appropriate special characters and wrap the string in either single quotes, double quotes, or backticks depending on the string content. The Copy string contents instead copies the raw string contents (including new lines and other special characters) verbatim to the clipboard. Finally, Copy as JSON literal formats the string as a valid JSON literal and copies it to the clipboard.

Chromium issue: 1208389

Improved CORS debugging

CORS-related TypeErrors in the Console are now linked to the Network panel and Issues tab.

Click on the two new icons next to the CORS-related error message to view the network request, or understand the error message further and get potential solutions in the Issues tab.

Icons next to the CORS-related error message

Chromium issue: 1213393

Lighthouse 8.1

The Lighthouse panel is now running Lighthouse 8.1.

Lighthouse

If your site exposes source maps to Lighthouse, look for the View Treemap button to see a breakdown of your shipped JavaScript, filterable by size and coverage on load.

The report also includes a new metric filter (Refer to the Show audits relevant to filter in the screenshot). Pick a metric to focus on the opportunities and diagnostics most relevant to improving just that metric.

The Performance Category had a number of scoring changes to align with other performance tools and to better reflect the state of the web.

Check out the release notes for a full list of changes.

Chromium issue: 772558

Display new note URL in the Manifest pane

The Manifest pane now displays the the new note URL.

Currently on Chrome OS (CrOS), Chrome Apps and Android Apps that declare a "new-note" capability may be selected as a note-taking app in the Stylus settings (shows up if the CrOS device has been used with a stylus). When selected as a note-taking app, the app can be launched from the stylus palette's "Create Note" button. Adding new-note-url field in the application manifest is part of the effort to add equivalent functionality to web apps.

New note URL in the Manifest pane

Chromium issue: 1185678

Fixed CSS matching selectors

DevTools fixed the CSS matching selectors, it was not working in the last release.

The comma separated selectors in the Styles pane are colored differently depending on whether they match the selected DOM node:

  • An unmatched portion is shown in a light grey.
  • A matching selector portion is shown in black.

CSS matching selectors

Chromium issue: 1219153

Pretty-printing JSON responses in the Network panel

You can now pretty print JSON responses in the Network panel.

Open a JSON response in the Network panel, click on the {} icon to pretty-print it.

Pretty-printing JSON responses in the Network panel

Chromium bug: 998674

#google #chrome #devtools

Sean Robertson

Sean Robertson

1614304461

Chrome 89 - What’s New in DevTools

New to DevTools in Chrome 89:

What’s new in DevTools (Chrome 89) → http://goo.gle/3qvGNrc

Getting started with Trust Tokens → http://goo.gle/3s63pyV

Debugging support for Trusted Types → http://goo.gle/3u57chx

Lighthouse 7 → http://goo.gle/3jWQjRK

You’re not seeing double! We published this episode in English and in Jecelyn’s mother language Cantonese as part of our Mother Language Day series.

#devtools #google-chrome #developer

Assic Bale

Assic Bale

1598601394

Chrome 85 - What’s New in DevTools

New to DevTools in Chrome 85:

0:18 Style editing for CSS-in-JS framework
0:52 Lighthouse 6 in the Lighthouse panel
2:16 Support for new JavaScript features
2:56 Bonus tips: Use snippets for quick access to console commands

Links:

Check out the blog version of these release notes here → https://goo.gle/3gjD3TN

Tweet us → https://goo.gle/38mi9Ay

Web Vitals →https://goo.gle/32rlNHg

What’s New in Lighthouse → https://goo.gle/32qvLZf

What’s New in DevTools → https://goo.gle/2MeR5Kx

Subscribe to Google Chrome Developers → http://goo.gl/LLLNvf

#devtools #chrome 85 #css #javascript