Upgrading @web/test-runner-core from 0.10.4 to 0.10.5 gave these errors:
> wtr --coverage
src/components/map/themed-map.test.js:
❌ Error: Protocol error (Profiler.takePreciseCoverage): Precise coverage has not been started.
Error: Protocol error (Profiler.takePreciseCoverage): Precise coverage has not been started.
at /path/to/project/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:208:63
at new Promise (<anonymous>)
at CDPSession.send (/path/to/project/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:207:16)
at ChromeLauncherPage.collectTestCoverage (/path/to/project/node_modules/@web/test-runner-chrome/dist/ChromeLauncherPage.js:58:60)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async ChromeLauncherPage.stopSession (/path/to/project/node_modules/@web/test-runner-chrome/dist/ChromeLauncherPage.js:28:30)
at async ChromeLauncher.stopSession (/path/to/project/node_modules/@web/test-runner-chrome/dist/ChromeLauncher.js:141:24)
src/components/sites/add-site/location/site-location.test.js:
❌ Tests were interrupted because the page navigated to about:blank. This can happen when clicking a link, submitting a form or interacting with window.location.
Upgrading
@web/test-runner-core
from 0.10.4 to 0.10.5 gave these errors:Downgrading to 0.10.4 resolved the issue
tsconfig.json
```json { "include": ["src", "lib"], "exclude": ["node_modules", "**/node_modules/**/node_modules"], "compilerOptions": { "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "moduleResolution": "Node", "rootDir": ".", "target": "ES2019", "module": "ESNext", "noEmitOnError": false, "baseUrl": ".", "sourceMap": true, "plugins": [ { "transform": "@zerollup/ts-transform-paths" }, { "name": "ts-lit-plugin" } ], "paths": { "leaflet": ["leaflet/dist/leaflet-src.esm.js", "leaflet"], "date-fns/*": ["date-fns/esm/*"], "#schema": ["src/apollo/schema"], "#etc": ["more/paths/after/this"] }, "typeRoots": [ "./node_modules/@types", "./typings" ] }, "lib": [ "ESNext.array", "ES2020", "ES2019.array", "ES2020.Intl.d.ts", "DOM", "DOM.iterable" ] } ```web-test-runner.config.mjs
```js import devserverConfig from './web-dev-server.config.mjs'; import { esbuildPlugin } from '@web/dev-server-esbuild'; import { defaultReporter } from '@web/test-runner'; import { junitReporter } from '@web/test-runner-junit-reporter'; const coverageExclude = [ // Files that contain only static objects or exports '**/*.graphql', '**/*.css', '**/*.json', '**/index.js', // Files that contain high-level UI components (we should test these e2e instead) '**/src/components/sites/add-site/**/*', // Files that probably should be tested but must at the moment remain neglected '**/src/components/address-lookup/**/*', '**/src/components/table/**/*', '**/src/components/card/**/*', '**/src/components/sites/update-site/**/*', '**/src/auth0/*', ]; /** @type {import('@web/test-runner').TestRunnerConfig} */ const config = { ...devserverConfig, plugins: [ ...devserverConfig.plugins, esbuildPlugin({ ts: true }), ], port: 8081, coverage: true, files: [ 'src/**/*.test.js', 'lib/**/*.test.js', ], reporters: [ defaultReporter(), junitReporter({ outputPath: './results/test-results.xml' }), ], testRunnerHtml: testRunnerImport => ` `, coverageConfig: { exclude: coverageExclude, report: true, reportDir: 'coverage', threshold: { statements: 50, branches: 50, functions: 50, lines: 50, }, }, }; export default config; ```web-dev-server.config.mjs
```js import dotenv from 'dotenv'; dotenv.config(); import { hmrPlugin, presets } from '@open-wc/dev-server-hmr'; import { fromRollup } from '@web/dev-server-rollup'; import _commonjs from '@rollup/plugin-commonjs'; import _replace from '@rollup/plugin-replace'; import _litcss from 'rollup-plugin-lit-css'; import _graphql from '@apollo-elements/rollup-plugin-graphql'; import _json from '@rollup/plugin-json'; const litcss = fromRollup(_litcss); const json = fromRollup(_json); const graphql = fromRollup(_graphql); const commonjs = fromRollup(_commonjs); const replace = fromRollup(_replace); const { // yadda yadda } = process.env; const REPLACEMENTS = { // yadda yadda }; const excludeCSS = [ 'src/styles.css', 'src/assets/icons/style.css', '**/node_modules/leaflet/dist/leaflet.css', '**/node_modules/@power-elements/package-info/*.css', ]; const cjsIncludes = [ '**/node_modules/**/*.cjs.js', '**/node_modules/**/*.cjs', '**/node_modules/bind-decorator/**/*', '**/node_modules/fast-json-stable-stringify/index.js', '**/graphql-tag/**/*', '**/node_modules/zen-observable/**/*', ]; import proxy from 'koa-proxies'; /** @type {typeof presets.litElement} */ const litApolloPreset = { decorators: [ { name: 'customElement', import: '@apollo-elements/lit-apollo' }, ], baseClasses: [ { name: 'ApolloQuery', import: '@apollo-elements/lit-apollo' }, { name: 'ApolloMutation', import: '@apollo-elements/lit-apollo' }, { name: 'ApolloSubscription', import: '@apollo-elements/lit-apollo' }, ], }; const hmrIncludes = [ 'src/**/*.{js,json,graphql,css,html,svg}', ]; /** @type {import('@web/dev-server').DevServerConfig} */ const config = { nodeResolve: true, appIndex: 'index.html', port: 8000, rootDir: '.', mimeTypes: { 'src/styles.css': 'css', 'src/assets/icons/style.css': 'css', 'src/**/*.json': 'js', 'src/**/*.css': 'js', 'src/**/*.graphql': 'js', }, middleware: [ proxy('/files/', { target: 'https://app.app/api/v1/', changeOrigin: true, logs: true, }), proxy('/screenshot/', { target: 'http://localhost:7072/', changeOrigin: true, logs: true, }), proxy('/graphql/', { target: 'http://localhost:7071/', changeOrigin: true, logs: true, }), async (ctx, next) => { await next(); ctx.set('Cache-Control', 'max-age=0, stale-while-revalidate=360'); }, ], plugins: [ litcss({ exclude: excludeCSS }), json({ exclude: ['/custom-elements.json', '/licenses.json'] }), graphql(), replace(REPLACEMENTS), // hmrPlugin({ include: hmrIncludes, presets: [presets.litElement, litApolloPreset] }), commonjs({ include: cjsIncludes }), ], }; export default config; ```