Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: better log message when ps fails #2229

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/Python_tests.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# TODO: Line 47, enable pytest --doctest-modules

name: Tests
on: [push, pull_request]
jobs:
Tests:
strategy:
fail-fast: false
max-parallel: 15
matrix:
node: [10.x, 12.x, 14.x]
python: [3.6, 3.7, 3.8]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
env:
PYTHON_VERSION: ${{ matrix.python }}
- name: Install Dependencies
run: |
npm install --no-progress
pip install flake8 pytest
- name: Set Windows environment
if: matrix.os == 'windows-latest'
run:
echo '::set-env name=GYP_MSVS_VERSION::2015'
echo '::set-env name=GYP_MSVS_OVERRIDE_PATH::C:\\Dummy'
- name: Lint Python
if: matrix.os == 'ubuntu-latest'
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run Python tests
run: |
python -m pytest
# - name: Run doctests with pytest
# run: python -m pytest --doctest-modules
- name: Run Node tests
run: |
npm test
93 changes: 0 additions & 93 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# `node-gyp` - Node.js native addon build tool

[![Travis CI](https://travis-ci.com/nodejs/node-gyp.svg?branch=master)](https://travis-ci.com/nodejs/node-gyp)
[![Build Status](https://github.com/nodejs/node-gyp/workflows/Python_tests/badge.svg)](https://github.com/nodejs/node-gyp/actions?workflow=Python_tests)
[![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=master)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amaster)

`node-gyp` is a cross-platform command-line tool written in Node.js for
compiling native addon modules for Node.js. It contains a vendored copy of the
Expand Down Expand Up @@ -49,7 +48,7 @@ Install the current version of Python from the [Microsoft Store package](https:/

#### Option 1

Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator).
Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator).

#### Option 2

Expand Down
2 changes: 1 addition & 1 deletion lib/find-visualstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ VisualStudioFinder.prototype = {

const failPowershell = () => {
this.addLog(
'could not use PowerShell to find Visual Studio 2017 or newer')
'could not use PowerShell to find Visual Studio 2017 or newer, run command with \'--loglevel silly\' to figure out why')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit too definite, you may not figure out why. Maybe:

"try re-running with --loglevel=silly for more details"

cb(null)
}

Expand Down
16 changes: 11 additions & 5 deletions test/test-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
const test = require('tap').test
const gyp = require('../lib/node-gyp')

test('options in environment', function (t) {
test('options in environment', (t) => {
t.plan(1)

// `npm test` dumps a ton of npm_config_* variables in the environment.
Object.keys(process.env)
.filter(function (key) { return /^npm_config_/.test(key) })
.forEach(function (key) { delete process.env[key] })
.filter((key) => /^npm_config_/.test(key))
.forEach((key) => { delete process.env[key] })

// in some platforms, certain keys are stubborn and cannot be removed
const keys = Object.keys(process.env)
.filter((key) => /^npm_config_/.test(key))
.map((key) => key.substring('npm_config_'.length))
.concat('argv', 'x')

// Zero-length keys should get filtered out.
process.env.npm_config_ = '42'
Expand All @@ -18,8 +24,8 @@ test('options in environment', function (t) {
// Except loglevel.
process.env.npm_config_loglevel = 'debug'

var g = gyp()
const g = gyp()
g.parseArgv(['rebuild']) // Also sets opts.argv.

t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x'])
t.deepEqual(Object.keys(g.opts).sort(), keys.sort())
})