diff options
author | isaacs <i@izs.me> | 2020-11-19 22:30:40 +0300 |
---|---|---|
committer | Darcy Clarke <darcy@darcyclarke.me> | 2020-12-03 00:26:52 +0300 |
commit | 15d7333f832e3d68ae16895569f27a27ef86573e (patch) | |
tree | 32bca58d2ded2fe16e981530a7474ae14a0b00a0 /test/lib/utils | |
parent | e9a440bcc5bd9a42dbdbf4bf9340d188c910857c (diff) |
Use @npmcli/run-script for exec, explore; add interactive exec
This removes all other arg/shell escaping mechanisms, as they are no
longer needed, and will be un-done by puka in @npmcli/run-script anyway.
Adds an interactive shell mode when `npm exec` is run without any
arguments, allowing users to interactively test out commands in an npm
script environment. Previously, this would do nothing, and just exit.
Prevent weird behavior from `npm explore ../blah`. `explore` now can
_only_ be used to explore packages that are actually found in the
relevant `node_modules` folder.
Diffstat (limited to 'test/lib/utils')
-rw-r--r-- | test/lib/utils/escape-arg.js | 15 | ||||
-rw-r--r-- | test/lib/utils/escape-exec-path.js | 15 |
2 files changed, 0 insertions, 30 deletions
diff --git a/test/lib/utils/escape-arg.js b/test/lib/utils/escape-arg.js deleted file mode 100644 index b80a63f0b..000000000 --- a/test/lib/utils/escape-arg.js +++ /dev/null @@ -1,15 +0,0 @@ -const requireInject = require('require-inject') -const t = require('tap') -const getEscape = win => requireInject('../../../lib/utils/escape-arg.js', { - '../../../lib/utils/is-windows.js': win, - path: require('path')[win ? 'win32' : 'posix'], -}) - -const winEscape = getEscape(true) -const nixEscape = getEscape(false) - -t.equal(winEscape('hello/to the/world'), '"hello\\to the\\world"') -t.equal(nixEscape(`hello/to-the/world`), `hello/to-the/world`) -t.equal(nixEscape(`hello/to the/world`), `'hello/to the/world'`) -t.equal(nixEscape(`hello/to%the/world`), `'hello/to%the/world'`) -t.equal(nixEscape(`hello/to'the/world`), `'hello/to'"'"'the/world'`) diff --git a/test/lib/utils/escape-exec-path.js b/test/lib/utils/escape-exec-path.js deleted file mode 100644 index f16c576ec..000000000 --- a/test/lib/utils/escape-exec-path.js +++ /dev/null @@ -1,15 +0,0 @@ -const requireInject = require('require-inject') -const t = require('tap') -const getEscape = win => requireInject('../../../lib/utils/escape-exec-path.js', { - '../../../lib/utils/is-windows.js': win, - path: require('path')[win ? 'win32' : 'posix'], -}) - -const winEscape = getEscape(true) -const nixEscape = getEscape(false) - -t.equal(winEscape('hello/to the/world'), 'hello\\"to the"\\world') -t.equal(nixEscape(`hello/to-the/world`), `hello/to-the/world`) -t.equal(nixEscape(`hello/to the/world`), `'hello/to the/world'`) -t.equal(nixEscape(`hello/to%the/world`), `'hello/to%the/world'`) -t.equal(nixEscape(`hello/to'the/world`), `'hello/to'"'"'the/world'`) |