Skip to content

Refactor tests / port to tape #301

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

Merged
merged 18 commits into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 12 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ environment:
- nodejs_version: 0.10
- nodejs_version: 4
- nodejs_version: 6
- nodejs_version: 8

platform:
- x64
Expand All @@ -15,14 +16,19 @@ shallow_clone: true
install:
- ps: Install-Product node $env:nodejs_version $env:Platform
- ps: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
# make [email protected] x86 builds work
# https://github.com/mapbox/node-pre-gyp/issues/209#issuecomment-217690537
- npm config set -g cafile=package.json
- npm config set -g strict-ssl=false
- npm config get
# upgrade node-gyp to dodge 2013 compile issue present in the node gyp bundled with node v0.10
# https://github.com/nodejs/node-gyp/issues/972#issuecomment-231055109
- npm install [email protected]
- node --version
- IF "%nodejs_version:~0,1%"=="0" npm install [email protected]
# upgrade node-gyp to dodge https://github.com/mapbox/node-pre-gyp/issues/209#issuecomment-307641388
# and allow make node 4.x x86 builds work
# https://github.com/mapbox/node-pre-gyp/issues/209#issuecomment-217690537
- IF "%nodejs_version:~0,1%"=="4" npm install [email protected]
# downgrade npm to avoid multiple npm bugs:
# for node v6 this dodges npm 3.10.10 bug whereby --nodedir/--dist-url is not passed to node-gyp (https://github.com/mapbox/node-pre-gyp/issues/300)
# for all node x86 versions this dodges a mysterious ELIFECYCLE error: https://ci.appveyor.com/project/Mapbox/node-pre-gyp/build/1.0.582/job/b8q2nud6vkj0s6qo#L233
# for node v8 this dodges https://github.com/mapbox/node-pre-gyp/issues/302
- npm install [email protected] -g - node --version
- npm --version
- node -e "console.log(process.arch);"
- IF /I "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH%
Expand Down
7 changes: 5 additions & 2 deletions bin/node-pre-gyp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ prog.parseArgv(process.argv);
if (prog.todo.length === 0) {
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
console.log('v%s', prog.version);
} else {
return process.exit(0);
} else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) {
console.log('%s', prog.usage());
return process.exit(0);
}
return process.exit(0);
console.log('%s', prog.usage());
return process.exit(1);
}

// if --no-color is passed
Expand Down
15 changes: 15 additions & 0 deletions lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) {
abi_crosswalk = require('./abi_crosswalk.json');
}

var major_versions = {};
Object.keys(abi_crosswalk).forEach(function(v) {
var major = v.split('.')[0];
if (!major_versions[major]) {
major_versions[major] = v;
}
});

function get_electron_abi(runtime, target_version) {
if (!runtime) {
throw new Error("get_electron_abi requires valid runtime arg");
Expand Down Expand Up @@ -136,6 +144,13 @@ function get_runtime_abi(runtime, target_version) {
break;
}
}
} else if (major >= 2) {
// look for last release that is the same major version
if (major_versions[major]) {
cross_obj = abi_crosswalk[major_versions[major]];
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target');
}
} else if (major === 0) { // node.js
if (target_parts[1] % 2 === 0) { // for stable/even node.js series
// look for the last release that is the same minor release
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,25 @@
"request": "^2.81.0",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tape": "^4.6.3",
"tar": "^2.2.1",
"tar-pack": "^3.4.0"
},
"devDependencies": {
"aws-sdk": "^2.28.0",
"mocha": "^3.2.0",
"retire": "^1.2.12",
"jshint": "^2.9.4"
},
"jshintConfig": {
"node": true,
"globalstrict": true,
"undef": true,
"unused": true,
"noarg": true,
"mocha": true
"unused": false,
"noarg": true
},
"scripts": {
"pretest": "jshint test/build.test.js test/s3_setup.test.js test/versioning.test.js",
"update-crosswalk": "node scripts/abi_crosswalk.js",
"test": "jshint lib lib/util scripts bin/node-pre-gyp && mocha -R spec --timeout 500000"
"test": "jshint lib lib/util scripts bin/node-pre-gyp && tape test/*test.js"
}
}
Loading