Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTRL + CLICK in Output view on Windows in WSL does not work properly #2515

Closed
tomitrescak opened this issue Sep 14, 2020 · 9 comments
Closed

Comments

@tomitrescak
Copy link

tomitrescak commented Sep 14, 2020

Issue description or question

Hi, I am on Windows VS Code, running code in Ubuntu in WSL.
It is a Typescript project. The output display correct line number of the error, but when I ctrl+click it it takes me to the correct file but incorrect line.

Wallaby diagnostics report

{
  editorVersion: '1.48.2',
  pluginVersion: '1.0.237',
  editorType: 'VSCode',
  osVersion: 'linux 4.19.104-microsoft-standard',
  nodeVersion: 'v14.9.0',
  coreVersion: '1.0.956',
  checksum: 'ZTY3MzlmZDgwZWY4ZmQ1NDNkMzk2MjliNWQxNTBlMGMsMTYwNzM4NTYwMDAwMCww',
  config: {
    files: [
      { pattern: 'src/setup.ts', ignore: false, trigger: true, load: true, instrument: true, order: 1 },
      { pattern: 'src/**/*.ts', ignore: false, trigger: true, load: true, instrument: true, order: 2 },
      { pattern: 'src/**/*.tsx', ignore: false, trigger: true, load: true, instrument: true, order: 3 },
      { pattern: 'src/**/*.test.ts?(x)', ignore: true, trigger: true, load: true, instrument: true }
    ],
    tests: [ { pattern: 'src/**/*.test.ts?(x)', ignore: false, trigger: true, load: true, test: true, order: 4 } ],
    env: { type: 'node', NODE_ENV: 'test', CI: 1, params: {}, runner: '/usr/bin/node', viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
    testFramework: { version: 'mocha@2.1.0', configurator: 'mocha@2.1.0', reporter: 'mocha@2.1.0', starter: 'mocha@2.1.0' },
    compilers: { '**/*.ts?(x)': [Function (anonymous)], '**/*.?(lit)coffee?(.md)': [Function (anonymous)] },
    workers: { initial: 1, regular: 1, recycle: false },
    teardown: "function (wallaby) {\r\n      console.log('Teardown ..');\r\n      // global.jsdom();\r\n    }",
    diagnostics: {},
    filesWithNoCoverageCalculated: [],
    runAllTestsInAffectedTestFile: false,
    updateNoMoreThanOneSnapshotPerTestFileRun: false,
    preprocessors: {},
    maxConsoleMessagesPerTest: 100,
    autoConsoleLog: true,
    delays: { run: 0, edit: 100, update: 0 },
    hints: {
      ignoreCoverage: '__REGEXP /ignore coverage|istanbul ignore/',
      ignoreCoverageForFile: '__REGEXP /ignore file coverage/',
      commentAutoLog: '?',
      testFileSelection: { include: '__REGEXP /file\\.only/', exclude: '__REGEXP /file\\.skip/' }
    },
    automaticTestFileSelection: true,
    runSelectedTestsOnly: false,
    extensions: {},
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    loose: undefined,
    configCode: '// eslint-disable-next-line @typescript-eslint/no-var-requires\r\n' +
      "var path = require('path');\r\n" +
      '\r\n' +
      'module.exports = function (wallaby) {\r\n' +
      "  process.env.NODE_PATH += path.delimiter + path.join(wallaby.projectCacheDir, 'src');\r\n" +
      '\r\n' +
      '  return {\r\n' +
      "    files: ['src/setup.ts', 'src/**/*.ts', 'src/**/*.tsx', '!src/**/*.test.ts?(x)'],\r\n" +
      "    tests: ['src/**/*.test.ts?(x)'],\r\n" +
      '    env: {\r\n' +
      "      type: 'node',\r\n" +
      "      NODE_ENV: 'test',\r\n" +
      '      CI: 1\r\n' +
      '    },\r\n' +
      "    testFramework: 'mocha',\r\n" +
      '    // compilers: {\r\n' +
      "    //   '**/*.ts?(x)': wallaby.compilers.typeScript({\r\n" +
      '    //     // typescript: require("ttypescript"),\r\n' +
      "    //     module: 'commonjs',\r\n" +
      "    //     jsx: 'react'\r\n" +
      '    //     // plugins: [{ transform: "tsx-control-statements" }],\r\n' +
      '    //   })\r\n' +
      '    // },\r\n' +
      '    compilers: {\r\n' +
      "      '**/*.ts?(x)': wallaby.compilers.babel({\r\n" +
      '        // typescript: require("ttypescript"),\r\n' +
      '        // module: "commonjs",\r\n' +
      '        // jsx: "react",\r\n' +
      '        // plugins: [{ transform: "tsx-control-statements" }],\r\n' +
      "        presets: ['next/babel'],\r\n" +
      '        plugins: [\r\n' +
      "          'jsx-control-statements',\r\n" +
      "          ['@babel/plugin-proposal-decorators', { legacy: true }],\r\n" +
      "          ['@babel/plugin-proposal-class-properties', { loose: true }]\r\n" +
      '        ]\r\n' +
      '      })\r\n' +
      '    },\r\n' +
      '    workers: {\r\n' +
      '      initial: 1,\r\n' +
      '      regular: 1\r\n' +
      '    },\r\n' +
      '    // // reportUnhandledPromises: true,\r\n' +
      '    setup: function (wallaby) {\r\n' +
      "      require.extensions['.css'] = () => {\r\n" +
      '        /* */\r\n' +
      '      };\r\n' +
      '\r\n' +
      '      if (!global.document) {\r\n' +
      '        // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n' +
      "        global.jsdom = require('jsdom-global')(undefined, {\r\n" +
      "          url: 'http://localhost'\r\n" +
      '        });\r\n' +
      '      }\r\n' +
      '\r\n' +
      '      console.log(wallaby.projectCacheDir);\r\n' +
      '\r\n' +
      '      const mocha = wallaby.testFramework;\r\n' +
      "      mocha.suite.on('pre-require', function () {\r\n" +
      "        require(wallaby.projectCacheDir + '/src/mocha.config');\r\n" +
      '      });\r\n' +
      '    },\r\n' +
      '    teardown: function (wallaby) {\r\n' +
      "      console.log('Teardown ..');\r\n" +
      '      // global.jsdom();\r\n' +
      '    }\r\n' +
      '  };\r\n' +
      '};\r\n'
  },
  packageJSON: {
    dependencies: {
      '@emotion/core': '^10.0.35',
      '@emotion/styled': '^10.0.27',
      '@types/sinon': '^9.0.5',
      'apollo-server-micro': '^2.17.0',
      classnames: '^2.2.6',
      'date-fns': '^2.16.1',
      'evergreen-ui': '^5.0.6',
      graphql: '^15.3.0',
      marked: '^1.1.1',
      mobx: '^5.15.6',
      'mobx-react': '^6.3.0',
      next: '^9.5.3',
      react: '16.13.1',
      'react-dom': '16.13.1',
      'react-input-mask': '^2.0.4'
    },
    devDependencies: {
      '@babel/core': '^7.11.6',
      '@babel/plugin-proposal-class-properties': '^7.10.4',
      '@babel/plugin-proposal-decorators': '^7.10.5',
      '@babel/register': '^7.11.5',
      '@storybook/addon-actions': '^6.0.21',
      '@storybook/addon-essentials': '^6.0.21',
      '@storybook/addon-links': '^6.0.21',
      '@storybook/react': '^6.0.21',
      '@testing-library/jest-dom': '^5.11.4',
      '@testing-library/react': '^11.0.4',
      '@types/node': '^14.10.1',
      '@types/react': '^16.9.49',
      '@types/react-router-dom': '^5.1.5',
      '@typescript-eslint/eslint-plugin': '^4.1.0',
      '@typescript-eslint/parser': '^4.1.0',
      'babel-loader': '^8.1.0',
      'babel-plugin-jsx-control-statements': '^4.1.0',
      eslint: '^7.9.0',
      'eslint-config-prettier': '^6.11.0',
      'eslint-plugin-jsx-a11y': '^6.3.1',
      'eslint-plugin-jsx-control-statements': '^2.2.1',
      'eslint-plugin-prettier': '^3.1.4',
      'eslint-plugin-react-hooks': '^4.1.2',
      expect: '^26.4.2',
      'jest-sinon': '^1.0.4',
      jsdom: '^16.4.0',
      'jsdom-global': '^3.0.2',
      mocha: '^8.1.3',
      prettier: '^2.1.1',
      'react-is': '^16.13.1',
      shortid: '^2.2.15',
      sinon: '^9.0.3',
      'tsconfig-paths-webpack-plugin': '^3.3.0',
      typescript: '^4.0.2'
    }
  },
  fs: { numberOfFiles: 165 },
  debug: [
    '2020-09-14T06:36:31.287Z project Wallaby Node version: v14.9.0\n',
    '2020-09-14T06:36:31.287Z project Wallaby config: <homeDir>/Github/corpix-next/wallaby.js\n',
    '2020-09-14T06:36:32.111Z project File cache: <homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.237/projects/0afa06fbb9fd3103\n',
    '2020-09-14T06:36:32.126Z uiService Listening port 51235\n',
    '2020-09-14T06:36:32.152Z workers Parallelism for initial run: 1, for regular run: 1\n',
    '2020-09-14T06:36:32.152Z workers Starting run worker instance #0\n',
    '2020-09-14T06:36:32.165Z workers Web server is listening at 36101\n',
    '2020-09-14T06:36:32.226Z project File cache requires some updates, waiting required files from IDE\n',
    '2020-09-14T06:36:32.425Z workers Started run worker instance (delayed) #0\n',
    '2020-09-14T06:36:33.688Z project Compiler did not set ranges for file [src/@toryjs/form/index.ts]\n',
    '2020-09-14T06:36:33.787Z project Compiler did not set ranges for file [src/@toryjs/form/form_definition.ts]\n',
    '2020-09-14T06:36:34.674Z project Compiler did not set ranges for file [src/@toryjs/form/stores/schema_reference.ts]\n',
    '2020-09-14T06:36:34.676Z project Stopping process pool\n',
    '2020-09-14T06:36:34.678Z project Test run started; run priority: 3\n',
    '2020-09-14T06:36:34.681Z project Running all tests\n',
    '2020-09-14T06:36:34.686Z workers Starting test run, priority: 3\n',
    '2020-09-14T06:36:34.687Z nodeRunner Starting sandbox [worker #0, session #ik58w]\n',
    '2020-09-14T06:36:34.687Z nodeRunner Preparing sandbox [worker #0, session #ik58w]\n',
    '2020-09-14T06:36:34.687Z nodeRunner Prepared sandbox [worker #0, session #ik58w]\n',
    '2020-09-14T06:36:34.687Z workers [worker #0, session #ik58w] Running tests in sandbox\n',
    '2020-09-14T06:36:35.648Z workers [ik58w] Loaded 14 test(s)\n',
    '2020-09-14T06:36:35.688Z workers [ik58w] Test executed: creates json version of the form\n',
    '2020-09-14T06:36:35.692Z workers [ik58w] Test executed: users array props\n',
    '2020-09-14T06:36:35.711Z workers [ik58w] Test executed: findElementById: finds elements by id\n',
    '2020-09-14T06:36:35.734Z workers [ik58w] Test executed: uses prop helper to access atomic props\n',
    '2020-09-14T06:36:35.787Z workers [ik58w] Test executed: validates prop values\n',
    '2020-09-14T06:36:35.809Z workers [ik58w] Test executed: can change element to a new parent\n',
    '2020-09-14T06:36:35.810Z workers [ik58w] Test executed: can undo and redo\n',
    '2020-09-14T06:36:35.811Z workers [ik58w] Test executed: uses prop helper to access complex props\n',
    '2020-09-14T06:36:35.826Z workers [ik58w] Test executed: allows props to use direct access to .props accessor via proxy\n',
    '2020-09-14T06:36:35.840Z workers [ik58w] Test executed: changes the number of references when element is deleted\n',
    '2020-09-14T06:36:35.932Z workers [ik58w] Test executed: changes the number of references when prop type changes\n',
    '2020-09-14T06:36:35.989Z workers [ik58w] Test executed: changes the number of references when source type changes\n',
    '2020-09-14T06:36:36.002Z workers [ik58w] Test executed: when a schema is reparented, a new path is automatically calculated\n',
    '2020-09-14T06:36:36.016Z workers [ik58w] Test executed: allows to add a new control\n',
    '2020-09-14T06:36:36.081Z workers [ik58w] Run 14 test(s), skipped 0 test(s)\n',
    '2020-09-14T06:36:36.083Z workers [ik58w] Sandbox is responsive, closing it\n',
    '2020-09-14T06:36:36.084Z project Test run finished\n',
    '2020-09-14T06:36:36.085Z project Processed console.log entries\n',
    '2020-09-14T06:36:36.085Z project Processed loading sequences\n',
    '2020-09-14T06:36:36.085Z project Processed executed tests\n',
    '2020-09-14T06:36:36.106Z project Processed code coverage\n',
    '2020-09-14T06:36:36.215Z project Test run result processed and sent to IDE\n'
  ]
}
@ArtemGovorov
Copy link
Member

Can you please provide some example/screenshot of the wrong line mapping?

@tomitrescak
Copy link
Author

Wallaby1

Here you go

@ArtemGovorov
Copy link
Member

Thanks. Hmmm, interesting, looks like there's some internal link position shift happens for some reason. I don't think the issue is related to WSL though.

We'll try to create a sample repo based on your diagnostics report to reproduce the issue.

A couple of questions before we proceed:

  • any chance you can privately share the repo with us so we can reproduce the issue without create a sample repo (where things will probably work until we find a right combo of conditions leading to the issue)?
  • from your diagnostics report looks like you have 14 tests, however, on your screenshot you have over a hundred tests. Is the issue reproducible on the project with 14 tests that the diagnostics report was captured from?

@tomitrescak
Copy link
Author

@ArtemGovorov happy to share the repo, but do you have an email I can send it to? I would not like to share too publicly. Thanks.

As per #2, the diagnostic report was run when I had on describe.only statement, limiting the number of tests.

@ArtemGovorov
Copy link
Member

@tomitrescak Awesome, please send it to hello@wallabyjs.com.

@tomitrescak
Copy link
Author

Artem, no need for repo. I took the same project to windows (not WLS) and it works ok. I tried with a clean project and it messes up in WLS.

@ArtemGovorov
Copy link
Member

@tomitrescak Thanks for checking! Are you using WSL1 or WSL2?

I tried with a clean project

Can you please try it on this sample repo: /~https://github.com/wallabyjs/wallaby-jest-snapshots if it messes up links for you?

@tomitrescak
Copy link
Author

Hi, I'm on WSL 2, it works with Jest, but it is messing up with mocha (I just changed the target to "mocha").

module.exports = function (wallaby) {
  return {
    files: ["src/**/*.js?(x)", "!src/**/*.spec.js?(x)"],
    tests: ["src/**/*.spec.js?(x)"],

    env: {
      type: "node",
      runner: "node",
    },

    compilers: {
      "**/*.js?(x)": wallaby.compilers.babel(),
    },

    testFramework: "mocha",

    debug: true,
  };
};

@NikGovorov
Copy link
Member

Hi @tomitrescak,

Thanks for reporting the issue. We diagnosed it and apparently there is a bug in VS Code Remote, it for some reason ignores line/column numbers fragment in file URLs. We are going to report the issue the VS Code team, but in mean time we fixed it on our side and released the fix with v1.0.239.

@smcenlly smcenlly changed the title CTRL + CLICK in Output view on Windows in WLS does not work properly CTRL + CLICK in Output view on Windows in WSL does not work properly Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants