Skip to content

Commit

Permalink
ci test updates (#62)
Browse files Browse the repository at this point in the history
* add node 16.x testing
* disable watch dir when platform not win or mac
  • Loading branch information
msimerson committed Jun 11, 2021
1 parent 5f21b99 commit 4567de8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
strategy:
matrix:
os: [ windows-latest ]
node-version: [10.x, 12.x]
node-version: [ 12.x, 14.x, 16.x ]
fail-fast: false

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
name: git checkout
with:
fetch-depth: 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [10.x, 12.x]
node-version: [ 12.x, 14.x, 16.x ]
fail-fast: false

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
name: git checkout
with:
fetch-depth: 1
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
with:
version: 12.x

- name: install, run
- name: Install
run: npm install

- name: Test
run: |
npm install
npm install nyc codecov
npm run cover
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

strategy:
matrix:
node-version: [ 12.x ]
node-version: [ 14.x ]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
name: git checkout
with:
fetch-depth: 1
Expand All @@ -23,10 +23,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: npm install
- name: Install
run: npm install

- name: Lint using eslint
- name: Lint
run: npm run lint

env:
Expand Down
7 changes: 5 additions & 2 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

## 1.N.NN - 20YY-MM-DD
## NEXT - 202Y-MM-DD

## 1.0.19 - 2019-MM-DD

## 1.0.19 - 2021-06-10

- configfile: disable watch dir when platform not mac or win
- configfile: convert to es6 class
- configfile.read_dir: promisify
- configfile: use simpler es6 `for..in` and `for..of`
- getDir tests, use os.EOL for comparison


## 1.0.18 - 2019-10-11
Expand Down
3 changes: 3 additions & 0 deletions configfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ class cfreader {
if (this._watchers[dirPath]) return;
const watchOpts = { persistent: false, recursive: true }

// recursive is only supported on Windows (win32, win64) and macOS (darwin)
if (!/win/.test(process.platform)) watchOpts.recursive = false

this._watchers[dirPath] = fs.watch(dirPath, watchOpts, (fse, filename) => {
// console.log(`event: ${fse}, ${filename}`);
if (!filename) return;
Expand Down
44 changes: 22 additions & 22 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,30 +492,30 @@ describe('getDir', function () {
}
const self = this;
let callCount = 0;
function getDirDone (err, files) {
// console.log('Loading: test/config/dir');
if (err) console.error(err);
callCount++;
if (callCount === 1) {
// console.log(files);
assert.equal(err, null);
assert.equal(files.length, 3);
assert.equal(files[0].data, `contents1${os.EOL}`);
assert.equal(files[2].data, `contents3${os.EOL}`);
fs.writeFile(tmpFile, 'contents4\n', (err2, res) => {
assert.equal(err2, null);
// console.log('file touched, waiting for callback');
// console.log(res);
});
}
if (callCount === 2) {
assert.equal(files[3].data, 'contents4\n');
done();
}
}

function getDir () {
const opts2 = { type: 'binary', watchCb: getDir };
self.config.getDir('dir', opts2, getDirDone);
self.config.getDir('dir', opts2, (err, files) => {
// console.log('Loading: test/config/dir');
if (err) console.error(err);
callCount++;
if (callCount === 1) {
// console.log(files);
assert.equal(err, null);
assert.equal(files.length, 3);
assert.equal(files[0].data, `contents1${os.EOL}`);
assert.equal(files[2].data, `contents3${os.EOL}`);
fs.writeFile(tmpFile, 'contents4\n', (err2, res) => {
assert.equal(err2, null);
// console.log('file touched, waiting for callback');
// console.log(res);
});
}
if (callCount === 2) {
assert.equal(files[3].data, 'contents4\n');
done();
}
});
}
getDir();
})
Expand Down

0 comments on commit 4567de8

Please sign in to comment.