Skip to content
Closed
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
16 changes: 16 additions & 0 deletions test/parallel/test-fs-timestamp-parsing-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';
require('../common');
const assert = require('assert');
const fs = require('fs');

[undefined, null, []].forEach((input) => {
assert.throws(() => fs._toUnixTimestamp(input)
, new RegExp('^Error: Cannot parse time: ' + input + '$'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It passed the linter, but the comma that starts this line, and the comma starting line 12 should be moved to the preceding lines.

});

assert.throws(() => fs._toUnixTimestamp({})
, /^Error: Cannot parse time: \[object Object\]$/);

[1, '1', Date.now(), -1, '-1', Infinity].forEach((input) => {
assert.doesNotThrow(() => fs._toUnixTimestamp(input));
});