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

Test suite subject to failures due to remappings in settings.json #451

Closed
ascandella opened this issue Jul 15, 2016 · 7 comments
Closed

Comments

@ascandella
Copy link
Contributor

What did you do?

Ran the test suite for the project from VSCode debug. I have some custom "normal"/"other" remaps in my settings.json (to accomodate dvorak motion keys)

    "vim.otherModesKeyBindings": [
        {
            "before": ["n"],
            "after": ["k"]
        },
        {
            "before": ["t"],
            "after": ["j"]
        },
        {
            "before": ["s"],
            "after": ["l"]
        },
        {
            "before": [",", "w"],
            "after": [":", "w"]
        }
    ]

What did you expect to happen?

The test suite should pass, and not be affected by my key remaps

What happened instead?

Many tests fail due to my personal key remappings. For example:

  3) Mode Normal Can handle 'dt':
      Line 0 is different.
      + expected - actual
      -ext text
      +t text

      at Suite.suite (/Users/aiden/src/vscode-vim/test/mode/modeNormal.test.ts:250:5)
  4) Mode Normal can handle s in visual mode:
      Cursor CHARACTER position is wrong.
      + expected - actual
      -4
      +

I verified that it was due to the remappings by disabling my customizations in settings.json and re-running the tests.

Technical details:

  • VSCode Version: 1.3.1
  • VsCodeVim Version: current HEAD (5a2bce3e39303be6e914c04b43e0c3f896b306e4)
  • OS: OS X 10.11
@jpoon
Copy link
Member

jpoon commented Jul 15, 2016

Great catch, seems fairly easy to disable these settings on a test run.

@ascandella
Copy link
Contributor Author

ascandella commented Jul 15, 2016

Seems like the simplest place to handle this would be to check for this.isTesting in modeHandler.ts's handleKeyEvent(key: string). If that's the correct approach, I'm happy to whip up a PR and test with my settings enabled.

Then again, if other functionality is added to Remapper that level of disabling could mask some future bugs.

@johnfn
Copy link
Member

johnfn commented Jul 16, 2016

Thanks for the issue report!

@rebornix, you are refactoring settings, correct? If you do it right, fixing this issue should fall out of that with almost no other work required. 🙂

@rebornix
Copy link
Member

yes I'm working on the setting and I'll take a look at this one while implementing.

@jpoon jpoon self-assigned this Jul 16, 2016
@rebornix
Copy link
Member

I took a look at this issue again, and I found this actually has little to do with settings. This problem is totally the same as other configuration like Tab, Space, etc. When you run tests against your local VS Code, it will read your personal configuration while it's on Travis, it loads what Travis has, which is nothing.

For tabbing, what we do is resetting the tab/space config on the fly before each test suite. While not every configuration can be modified right now and the cost is too much. Yet again I suggest we use a separate test folder to hold test files and workspace configurations.

@johnfn
Copy link
Member

johnfn commented Jul 19, 2016

Makes sense to me. A separate settings.json for tests sounds ideal.

@jpoon jpoon removed their assignment Aug 6, 2016
@xconverge
Copy link
Member

FYI we have a testing flag now in globals, could be used here potentially...

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

5 participants