Skip to content

Commit

Permalink
Modified existing configurations to work with GitHub Actions Test setup.
Browse files Browse the repository at this point in the history
- Modified `scripts/test-node-webkit.sh` so that it can now accept an NW.js version as input. This allows running the script in a GitHub Actions matrix.
- Modified `test/run.util.js` so that it does not set `--msvs_version=2015` when running in GitHub Actions. This is required because current GitHub Actions runner do not support VS Studio 2015.
- Added npm script command `test:s3` to `package.json`  that runs only the s3 tests. This is required because invoking `npx tape test/s3.test.js` on windows does not work as expected.
- Modified `test/proxy-bcrypt.test.js`. Removed uneeded CI conditionals and modified download directory setup/cleanup. Latter was required due to concurrency issues with running tests on Mac, resulting in uncatchable errors during directory removal originating from `rimraf`.
  • Loading branch information
ronilan committed May 12, 2022
1 parent 7b8b09a commit 4cbbc79
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"fix": "npm run lint -- --fix",
"update-crosswalk": "node scripts/abi_crosswalk.js",
"test": "tape test/*test.js",
"test:s3": "tape test/s3.test.js",
"bucket": "node scripts/set-bucket.js"
}
}
4 changes: 3 additions & 1 deletion scripts/test-node-webkit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

nw_version=${1:-"0.50.2"}

set -eu
set -o pipefail

Expand All @@ -9,7 +11,7 @@ export PATH=`pwd`/bin:$PATH

BASE=$(pwd)

export NODE_WEBKIT_VERSION="0.50.2"
export NODE_WEBKIT_VERSION="${nw_version}"
export NW_INSTALL_URL="https://dl.nwjs.io"

if [[ `uname -s` == 'Darwin' ]]; then
Expand Down
24 changes: 3 additions & 21 deletions test/proxy-bcrypt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,6 @@ test.Test.prototype.stringContains = function(actual, contents, message) {
});
};

//
// skip tests that require a real S3 bucket when in a CI environment
// and the AWS access key is not available.
//
const isCI = process.env.CI && process.env.CI.toLowerCase() === 'true'
&& !process.env.AWS_ACCESS_KEY_ID;

function ciSkip(...args) {
if (isCI) {
test.skip(...args);
} else {
test(...args);
}
}
ciSkip.skip = function(...args) {
test.skip(...args);
};

test('setup proxy server', (t) => {
delete process.env.http_proxy;
delete process.env.https_proxy;
Expand All @@ -66,7 +48,7 @@ test('setup proxy server', (t) => {

// make sure the download directory deleted then create an empty one
rimraf(downloadDir, () => {
fs.mkdir('download', (e) => {
fs.mkdir(downloadDir, (e) => {
if (e && e.code !== 'EEXIST') {
t.error(e);
return;
Expand Down Expand Up @@ -140,6 +122,6 @@ test(`cleanup after ${__filename}`, (t) => {
delete process.env.NOCK_OFF;
delete process.env.http_proxy;
delete process.env.https_proxy;
// ignore errors
rimraf(downloadDir, () => t.end());

t.end();
});
2 changes: 1 addition & 1 deletion test/run.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function run(prog, command, args, app, opts, cb) {
}

// Test building with msvs 2015 since that is more edge case than 2013
if (process.platform === 'win32') {
if (process.platform === 'win32' && !process.env.GITHUB_ACTIONS) {
final_cmd += ' --msvs_version=2015 ';
}

Expand Down
1 change: 0 additions & 1 deletion test/s3.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ apps.forEach((app) => {
});
});


test(app.name + ' package ' + app.args, (t) => {
run('node-pre-gyp', 'package', '', app, {}, (err) => {
t.ifError(err);
Expand Down

0 comments on commit 4cbbc79

Please sign in to comment.