Skip to content

Commit 1c54ffb

Browse files
authored
fix: Avoid passing a null value to existsSync (#134)
chore(ci): Add additional Node versions to matrix chore(ci): Temporarily only build on x86_64 MacOS chore(ci): Skip sinon tests on Node 10/12 due to broken compatibility
1 parent 9b77d27 commit 1c54ffb

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
node: [10, 12, 14, 16]
35-
os: [ubuntu-latest, windows-latest, macos-latest]
34+
node: [10, 12, 14, 16, 18, 20, 22, 24]
35+
os: [ubuntu-latest, windows-latest, macos-13]
3636

3737
steps:
3838
- name: Clone repository

lib/find_config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ module.exports = function (opts) {
2020
configPath = fileSearch(configNameSearch, searchPaths);
2121
}
2222
// confirm the configPath exists and return an absolute path to it
23-
if (fs.existsSync(configPath)) {
23+
// Skip the call to fs.existsSync if configPath is null
24+
if (configPath && fs.existsSync(configPath)) {
2425
return path.resolve(configPath);
2526
}
2627
return null;

test/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ var Module = require('module');
33
var exec = require('child_process').exec;
44

55
var expect = require('expect');
6-
var sinon = require('sinon');
76
var resolve = require('resolve');
87

98
var Liftoff = require('../');
@@ -62,6 +61,13 @@ describe('Liftoff', function () {
6261

6362
describe('buildEnvironment', function () {
6463
it('should locate local module using cwd if no config is found', function (done) {
64+
if (process.versions.node.startsWith("10.") || process.versions.node.startsWith("12.")) {
65+
this.skip();
66+
return;
67+
}
68+
69+
var sinon = require('sinon');
70+
6571
var test = new Liftoff({ name: 'chai' });
6672
var cwd = 'explicit/cwd';
6773
var spy = sinon.spy(resolve, 'sync');
@@ -79,6 +85,13 @@ describe('Liftoff', function () {
7985
});
8086

8187
it('should locate global module using NODE_PATH if defined', function (done) {
88+
if (process.versions.node.startsWith("10.") || process.versions.node.startsWith("12.")) {
89+
this.skip();
90+
return;
91+
}
92+
93+
var sinon = require('sinon');
94+
8295
var test = new Liftoff({ name: 'dummy' });
8396
var cwd = 'explicit/cwd';
8497
var spy = sinon.spy(resolve, 'sync');

0 commit comments

Comments
 (0)