Skip to content

Commit 5077dcc

Browse files
chore: Publish with GitHub actions plus include node@22 in the build.
Build when pushed to main. Add node@22 and node@23. Fix tests for node22+ with less lenient async blocks. --------- Signed-off-by: Scott Schreckengaust <[email protected]>
1 parent 6e00cef commit 5077dcc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
node-version: ['22', '21', '20', '18', '16', '14']
9+
node-version: ['23', '22', '20', '18', '16', '14']
1010
os: ['windows-latest', 'ubuntu-24.04', 'ubuntu-latest', 'macos-latest', 'macos-13']
1111
exclude:
1212
# exclude node14 test on arm due to nodejs 14 release is not available for darwin-arm
@@ -97,7 +97,7 @@ jobs:
9797

9898
publish-release:
9999
name: Publish a Release
100-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
100+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
101101
needs: [test, test-docker]
102102
runs-on: ubuntu-latest
103103
steps:

tests/lib/file_system_tests.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,20 @@ describe('lib', () => {
195195
describe('setFileContents', async () => {
196196
const fs = new FileSystem(__dirname)
197197
const filePath = path.resolve(__dirname, 'text_file_for_test.txt')
198-
const contents = await realFs.promises.readFile(filePath)
198+
let contents
199199

200-
it('should throw an error if the file does not exist', async () => {
201-
expect(() => fs.getFileContents('notAFile')).to.throw()
200+
before(async () => {
201+
contents = await realFs.promises.readFile(filePath, 'utf8')
202+
})
203+
204+
it('should return undefined if the file does not exist', async () => {
205+
const actual = await fs.getFileContents('notAFile')
206+
expect(actual).to.equal(undefined)
202207
})
203208

204209
it('should change the contents of a file', async () => {
205210
const expected = 'somefilecontents\nmorecontents\n'
206-
fs.setFileContents('text_file_for_test.txt', expected)
211+
await fs.setFileContents('text_file_for_test.txt', expected)
207212
const fileContents = await realFs.promises.readFile(filePath, 'utf8')
208213
const realFileContents = fileContents.replace(/\r/g, '')
209214
expect(realFileContents).to.equal(expected)

0 commit comments

Comments
 (0)