Skip to content

During coverage run, errors printed for "Error retreiving source map for <random dep>" #1549

Open
@melink14

Description

@melink14

Command: wtr "extension/**/*test*" "--coverage"

Error example:

Error retreiving source map for /.snowpack/pkg/lodash.v4.17.21/common/_baseGetTag-9a4e71e2.js
SyntaxError: Unexpected token i in JSON at position 0
    at JSON.parse (<anonymous>)
    at new Converter (/home/espeed/projects/rikaikun/node_modules/convert-source-map/index.js:50:48)
    at Object.exports.fromJSON (/home/espeed/projects/rikaikun/node_modules/convert-source-map/index.js:94:10)
    at doFetchSourceMap (/home/espeed/projects/rikaikun/node_modules/@web/test-runner-core/dist/utils/fetchSourceMap.js:33:37)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.fetchSourceMap (/home/espeed/projects/rikaikun/node_modules/@web/test-runner-core/dist/utils/fetchSourceMap.js:62:23)
    at async Object.v8ToIstanbul (/home/espeed/projects/rikaikun/node_modules/@web/test-runner-coverage-v8/dist/index.js:47:33)
    at async ChromeLauncherPage.stopSession (/home/espeed/projects/rikaikun/node_modules/@web/test-runner-chrome/dist/ChromeLauncherPage.js:28:30)
    at async ChromeLauncher.stopSession (/home/espeed/projects/rikaikun/node_modules/@web/test-runner-chrome/dist/ChromeLauncher.js:142:24)

I receive about 20 of those all inside the .snowpack package.

I'm using snowpack plugin and my source code and tests are written in Typescript. The tests work find and the coverage report seems mostly correct so it seems like the errors aren't fatal. They do fill my terminal though and it'd be great to figure out how to suppress them.

All the files are in the special .snowpack directory that the snowpack builder puts browser ready node deps the project needs. I tried to exlude those files with exclude in coverageConfig but it seemed to have no difference.

@web/test-runner config:

export default {
  coverageConfig: {
    exclude: ['**/.snowpack/**/*', '**/*.test.ts*'],
  },
  browsers: [
    puppeteerLauncher({
      launchOptions: {
        executablePath: '/usr/bin/google-chrome',
        headless: true,
        // disable-gpu required for chrome to run for some reason.
        args: ['--disable-gpu', '--remote-debugging-port=9333'],
      },
    }),
  ],
  plugins: [snowpackWebTestRunner()],
  // Use custom runner HTML to add chrome stubs early since chrome APIs are used during
  // file initialization in rikaikun.
  testRunnerHtml: (testFramework) =>
    `<html>
      <body>
        <script type="module" src="test/chrome_stubs.js"></script>
        <script type="module" src="${testFramework}"></script>
      </body>
    </html>`,
  reporters: [
    // Gives overall test progress across all tests.
    defaultReporter({ reportTestResults: false, reportTestProgress: true }),
    // Gives detailed description of chai test spec results.
    new SpecReporter().specReporter(),
  ],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions