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

Tests: TypeError: settingPath.split is not a function #38847

Closed
bpasero opened this issue Nov 21, 2017 · 6 comments
Closed

Tests: TypeError: settingPath.split is not a function #38847

bpasero opened this issue Nov 21, 2017 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug engineering VS Code - Build / issue tracking / etc. verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Nov 21, 2017

I am seeing a weird issue where when I have a test failure in one of my unit tests, this exception pops up:

Editor Stacks Model Stack - Multiple Editors - Navigation (across groups):
			     TypeError: settingPath.split is not a function
			      at Object.getConfigurationValue (file:///Users/bpasero/Development/Microsoft/monaco/out/vs/platform/configuration/common/configuration.js:131:32)
			      at TestConfigurationService.inspect (file:///Users/bpasero/Development/Microsoft/monaco/out/vs/platform/configuration/test/common/testConfigurationService.js:47:40)
			      at formatValue (util.js:369:36)
			      at formatProperty (util.js:822:15)
			      at util.js:681:12
			      at Array.map (native)
			      at formatObject (util.js:680:15)
			      at formatValue (util.js:620:16)
			      at Object.inspect (util.js:203:10)
      at getMessage (assert.js:64:24)

To reproduce:

  • have a test failure (e.g. for me it was an assertion in editorStacksModelTest.ts
  • run "test.sh -g Stack"
  • see the error

It almost looks like the TestConfigurationService.inspect method ends up on the global stack and is used by the assert framework!?

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Nov 21, 2017
@bpasero bpasero assigned aeschli and sandy081 and unassigned weinand Nov 21, 2017
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug and removed debug Debug viewlet, configurations, breakpoints, adapter issues labels Nov 21, 2017
@aeschli aeschli removed their assignment Nov 21, 2017
@sandy081
Copy link
Member

This is because, Assert framework uses inspect function on an object to get its string format.
In your case, you are asserting EditorGroup objects. On failure, Assert gets the string format of the object recursively using properties of the object. Since EditorGroup object has configurationService property which has inspect method, Assert is trying to instantiate that method. Hence this error appears.

image

Not sure, how to fix this in general. But one way is to provide a message during assertion.

@bpasero
Copy link
Member Author

bpasero commented Nov 22, 2017

@sandy081 sucks, maybe ask mocha if there is a way to turn this off? I could not find anything in the documentation when I check just now.

@sandy081
Copy link
Member

@bpasero This assert is not from mocha. It is from node. See here

@sandy081 sandy081 added the engineering VS Code - Build / issue tracking / etc. label Nov 22, 2017
@sandy081 sandy081 added this to the November 2017 milestone Nov 22, 2017
@bpasero
Copy link
Member Author

bpasero commented Nov 22, 2017

@sandy081 interesting, maybe this helps: nodejs/node#8071 (comment) ?

@sandy081
Copy link
Member

@bpasero I disabled custom inspect for tests.

On a side note, the typings of node module does not expose the default options on inspect.

@bpasero
Copy link
Member Author

bpasero commented Nov 22, 2017

@sandy081 awesome

@bpasero bpasero added the verified Verification succeeded label Dec 5, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 6, 2018
lemanschik pushed a commit to code-oss-dev/code that referenced this issue Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug engineering VS Code - Build / issue tracking / etc. verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants