Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed EINVAL error with fs.utimesSync() due to incorrect Unix timestamp #3

Merged
merged 8 commits into from
Mar 26, 2017
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ The full list of options are as follows:

- `verbose`: outputs extra data whenever a fixture is accessed, along with the
parts used to create the name of the fixture.
- `touchHits`: disable timestamp update of fixture files on a cache hit.
- `includeHeaderNames`, `headerWhitelist`, `includeCookieNames`,
`cookieWhitelist`: detailed in a later section.
- 'debug': Useful for debugging the requests when there is a cache miss. If
Expand Down Expand Up @@ -421,9 +422,12 @@ data is retrieved from a file and sent back using a dummy response object.

## Original Sepia Contributors

* [Avik Das](https://github.com/avik-das)
* [Vlad Shlosberg](https://github.com/vshlos)
* [Ethan Goldblum](https://github.com/egoldblum)
* [Shao-Hua Kao](https://github.com/ethankao)
* [Deepank Gupta](https://github.com/deepankgupta)
* [Priyanka Salvi](https://github.com/salvipriyanka/)
* [Ashima Atul](https://github.com/ashimaatul)
* [Delwyn de Villiers](https://github.com/delwyn)
* [Mark Seminatore](https://github.com/mseminatore)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "replayer",
"author": "Avik Das <[email protected]>",
"version": "2.1.0",
"version": "2.1.1",
"description": "A VCR-like module that records HTTP interactions and plays them back for speed and reliability; forked from https://github.com/linkedin/sepia",
"keywords": [
"http",
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function touchOnHit(filename) {
}

filename = filename + '.headers';
var now = Date.now();
var now = Date.now() / 1000;

if (fs.existsSync(filename)) {
fs.utimesSync(filename, now, now);
Expand Down
4 changes: 2 additions & 2 deletions test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe('utils.js', function() {
const touchOnHit = replayerUtil.internal.touchOnHit;

beforeEach(function() {
sinon.stub(Date, 'now').returns('now');
sinon.stub(Date, 'now').returns(10000);
sinon.stub(fs, 'utimesSync'); // utimesSync becomes a noop
});

Expand All @@ -335,7 +335,7 @@ describe('utils.js', function() {
fs.existsSync.withArgs('my-filename.headers').returns(true);

touchOnHit('my-filename');
fs.utimesSync.calledWithExactly('my-filename.headers', 'now', 'now')
fs.utimesSync.calledWithExactly('my-filename.headers', 10, 10)
.should.equal(true);
});

Expand Down