# Wrap JS/TS runnables in quotes \(\#12932\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5e9f9b4eddd94dbe280d6d1bcd1e3aef46bd8ef8)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5e9f9b4eddd94dbe280d6d1bcd1e3aef46bd8ef8

Requested commit: 5e9f9b4eddd94dbe280d6d1bcd1e3aef46bd8ef8

Commit: 5e9f9b4eddd94dbe280d6d1bcd1e3aef46bd8ef8

Tree: 0f98460ca77a2035288c70865ab2b366ddacf9fd

Author: claytonrcarter

Committer: GitHub

## Message

````
Wrap JS/TS runnables in quotes (#12932)

Some of the runnables added in #12118 don't work for tests (or code)
that contain spaces. In other words, the runnable for a test like
```js
it('does the thing', () => ...)
```
would end up w/ something like `npx jest does the thing
/path/to/file.spec.js`, but what we really want is `npx jest
--testNamePattern "does the thing" /path/to/file.spec.js`. A similar
thing was happening for the "node execute selection" runnable: selecting
`let foo = 1` would run `node -e let foo = 1`, not `node -e "let foo =
1"`.

In my (somewhat limited?) experience, it's very common for tests like
these to include spaces, and of course a code selection is almost
certain to contain whitespace.

Not covered: 
- this just blindly wraps quotes around the symbol/code; in the future
it may make sense to try to figure out *what type of quote* to use. (eg
`it('does the "thing"', () => ...)` is a valid test name, but
`--testNamePattern "does the "thing""` would not work. Note the doubled
quotes.)
- I did not wrap the filenames in quotes to escape those for the shell,
nor did I test if that's actually an issue. In my experience, I've not
seen many (any?) test files that contain spaces in the name, but I
suspect that it would be an issue if a containing dir includes spaces.
(eg `npx jest ... /path/to/My Documents/Code/file.spec.js`

/cc @RemcoSmitsDev 

Release Notes:

- Fixed some runnables in Javascript/Typescript
````

## Parents

- [ec95a33d8cfc2ccbf59764d8cd00a779bdb63928](https://git.cafe/gitcafe/zed/commit/ec95a33d8cfc2ccbf59764d8cd00a779bdb63928?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5e9f9b4eddd94dbe280d6d1bcd1e3aef46bd8ef8?format=markdown)
