Skip to content

Commit

Permalink
Move bun install and tests to test:bun script.
Browse files Browse the repository at this point in the history
Bun install fails on some Linux distros, so it needs to be moved to a separate install and test script that is optional. It is still run in the GitHub workflow.
  • Loading branch information
raineorshine committed Apr 25, 2024
1 parent de4d555 commit cd72516
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: Unit Tests
run: npm run test:unit

- name: Bun Tests
run: npm run test:bun

- name: E2E Tests
run: npm run test:e2e
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 20
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,10 +30,11 @@
"lint:lockfile": "lockfile-lint",
"lint:markdown": "markdownlint \"**/*.md\" --ignore \"**/node_modules/**/*.md\" --ignore build --config .markdownlint.js",
"lint:src": "eslint --cache --cache-location node_modules/.cache/.eslintcache --ignore-path .gitignore --report-unused-disable-directives .",
"prepare": "src/scripts/install-hooks && test/bun-setup.sh",
"prepare": "src/scripts/install-hooks",
"prepublishOnly": "npm run build",
"prettier": "prettier . --check",
"test": "npm run test:unit && npm run test:e2e",
"test:bun": "test/bun-install.sh && mocha test/bun",
"test:unit": "mocha test test/package-managers/*",
"test:e2e": "./test/e2e.sh",
"ncu": "node build/cli.js"
Expand Down
4 changes: 2 additions & 2 deletions test/bun-setup.sh → test/bun-install.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Install bun if not installed.
# Must be run in a prepare script instead of devDependencies to avoid npm install failing on Windows.
bun -v &> /dev/null
# Cannot be added to devDependencies as bun currently does not work on Linux.
bun -v &>/dev/null
BUN_EXISTS="$?"

if [ $BUN_EXISTS -ne 0 ]; then
Expand Down
File renamed without changes.
@@ -1,12 +1,9 @@
import os from 'os'
import * as bun from '../../../src/package-managers/bun'
import chaiSetup from '../../helpers/chaiSetup'
import * as bun from '../../src/package-managers/bun'
import chaiSetup from '../helpers/chaiSetup'

chaiSetup()

// Bun not yet supported on Windows
const describeSkipWindows = os.platform() === 'win32' ? describe.skip : describe
describeSkipWindows('bun', function () {
describe('bun', function () {
it('list', async () => {
const result = await bun.list({ cwd: __dirname })
result.should.have.property('ncu-test-v2')
Expand Down
File renamed without changes.

0 comments on commit cd72516

Please sign in to comment.