Commit 1ced6e3
Changed files (4)
.github/workflows/test.yml
@@ -21,3 +21,22 @@ jobs:
timeout-minutes: 1
env:
FORCE_COLOR: 3
+
+ test-win32:
+ runs-on: windows-latest
+
+ strategy:
+ matrix:
+ node-version: [16.x, 18.x]
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ matrix.node-version }}
+ - run: npm i
+ - run: npm run test:win32
+ timeout-minutes: 1
+ env:
+ FORCE_COLOR: 3
src/core.ts
@@ -71,8 +71,10 @@ export const defaults: Options = {
}
try {
- defaults.shell = which.sync('bash')
- defaults.prefix = 'set -euo pipefail;'
+ if (process.platform !== 'win32') {
+ defaults.shell = which.sync('bash')
+ defaults.prefix = 'set -euo pipefail;'
+ }
} catch (err) {
// ¯\_(ツ)_/¯
}
test/win32/core.test.js
@@ -0,0 +1,30 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { suite } from 'uvu'
+import * as assert from 'uvu/assert'
+import '../../build/globals.js'
+
+const test = suite('core')
+
+$.verbose = false
+
+test('should work with windows-specific commands', async () => {
+ if (process.platform === 'win32') {
+ let p = await $`ver`
+ assert.match(p.stdout, /Windows/)
+ }
+})
+
+test.run()
package.json
@@ -38,7 +38,8 @@
"fmt": "prettier --write .",
"fmt:check": "prettier --check .",
"build": "tsc",
- "test": "tsc && PATH=$(env -i bash -c 'echo $PATH') node_modules/.bin/uvu test -i fixtures",
+ "test": "tsc && PATH=$(env -i bash -c 'echo $PATH') node_modules/.bin/uvu test -i fixtures -i win32",
+ "test:win32": "tsc && uvu test/win32",
"coverage": "c8 --check-coverage npm test -- -i package",
"mutation": "stryker run"
},