From efd81fb105d040a97fb5cd366e2dc0c3e54dc1d0 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Wed, 16 Dec 2020 03:15:24 +0200 Subject: [PATCH] test(script-runners): fix on Windows --- packages/plugin-commands-script-runners/package.json | 1 + packages/plugin-commands-script-runners/test/index.ts | 3 ++- pnpm-lock.yaml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-commands-script-runners/package.json b/packages/plugin-commands-script-runners/package.json index 4a76ab4e01..e7b79d915c 100644 --- a/packages/plugin-commands-script-runners/package.json +++ b/packages/plugin-commands-script-runners/package.json @@ -41,6 +41,7 @@ "@types/ramda": "^0.27.32", "@zkochan/rimraf": "^1.0.0", "execa": "^4.1.0", + "is-windows": "^1.0.2", "mz": "^2.7.0", "write-yaml-file": "^4.1.1" }, diff --git a/packages/plugin-commands-script-runners/test/index.ts b/packages/plugin-commands-script-runners/test/index.ts index f66ad58323..57286324cf 100644 --- a/packages/plugin-commands-script-runners/test/index.ts +++ b/packages/plugin-commands-script-runners/test/index.ts @@ -10,6 +10,7 @@ import prepare, { preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { DEFAULT_OPTS, REGISTRY } from './utils' import execa = require('execa') +import isWindows = require('is-windows') import fs = require('mz/fs') import path = require('path') import writeYamlFile = require('write-yaml-file') @@ -389,7 +390,7 @@ test('pnpm run with custom shell', async () => { dir: process.cwd(), extraBinPaths: [], rawConfig: {}, - scriptShell: path.resolve('node_modules/.bin/shell-mock'), + scriptShell: path.resolve(`node_modules/.bin/shell-mock${isWindows() ? '.cmd' : ''}`), }, ['build']) expect((await import(path.resolve('shell-input.json'))).default).toStrictEqual(['-c', 'foo bar']) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3645d898e7..9b4b68d5c9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2013,6 +2013,7 @@ importers: '@types/ramda': 0.27.32 '@zkochan/rimraf': 1.0.0 execa: 4.1.0 + is-windows: 1.0.2 mz: 2.7.0 write-yaml-file: 4.1.1 specifiers: @@ -2032,6 +2033,7 @@ importers: '@types/ramda': ^0.27.32 '@zkochan/rimraf': ^1.0.0 execa: ^4.1.0 + is-windows: ^1.0.2 mz: ^2.7.0 p-limit: ^3.1.0 path-exists: ^4.0.0