From c0b666c0199c983d8bce1daeccdc8887794c030d Mon Sep 17 00:00:00 2001 From: markse Date: Thu, 1 Dec 2016 12:08:11 -0800 Subject: [PATCH 1/8] Fixed EINVAL error with fs.utimesSync() due to incorrect Unix timestamp --- src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.js b/src/util.js index a5dce6b..dc30237 100644 --- a/src/util.js +++ b/src/util.js @@ -209,7 +209,7 @@ function touchOnHit(filename) { } filename = filename + '.headers'; - var now = Date.now(); + var now = Infinity; // per NodeJS this will correctly set timestamp to Date.now() / 1000 if (fs.existsSync(filename)) { fs.utimesSync(filename, now, now); From ef3310f9457dca4a01bc8e684b42a4a68b3bf117 Mon Sep 17 00:00:00 2001 From: markse Date: Thu, 1 Dec 2016 12:21:13 -0800 Subject: [PATCH 2/8] documented touchHits option --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6eb43d3..9c73c92 100644 --- a/README.md +++ b/README.md @@ -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 From 91ecb08e168317b16aa53e51e157a46c687f18d9 Mon Sep 17 00:00:00 2001 From: Avik Das Date: Mon, 5 Dec 2016 22:28:13 -0800 Subject: [PATCH 3/8] Enforce 80-character line length --- .jshintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.jshintrc b/.jshintrc index d59789c..b91e65b 100644 --- a/.jshintrc +++ b/.jshintrc @@ -31,6 +31,7 @@ "laxbreak": false, "laxcomma": false, "loopfunc": false, + "maxlen": 80, "multistr": true, "newcap": false, "noarg": true, From 66acbc64a1cd5233fff80fe6de4cf275c529cb6e Mon Sep 17 00:00:00 2001 From: Avik Das Date: Mon, 5 Dec 2016 22:30:17 -0800 Subject: [PATCH 4/8] Use correct timestamp for fs.utimesSync As per the node.js documentation for `fs.utimes`: > The value should be a Unix timestamp in seconds. For example, > `Date.now()` returns milliseconds, so it should be divided by 1000 > before passing it in. I'm not sure why this wasn't causing a problem for most people, but it was reported by @mseminatore as a problem on Windows, on node.js v0.12.2. In any case, this fix doesn't cause a problem on Linux, on node.js v6.9.1, so I'm happy to make the fix. --- test/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/util.js b/test/util.js index 3f72151..bd6c470 100644 --- a/test/util.js +++ b/test/util.js @@ -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 }); @@ -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); }); From ee5f5cbac378bcbb173b8da64af99a8a5d292ddd Mon Sep 17 00:00:00 2001 From: Avik Das Date: Mon, 5 Dec 2016 22:37:50 -0800 Subject: [PATCH 5/8] Add to contributors list - Added myself. - Added @delwyn, who had made a contribution earlier. - Added @mseminatore, who contributed recently. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9c73c92..e308896 100644 --- a/README.md +++ b/README.md @@ -422,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) From 7a3841bf7d1a7479fa7b08242251246c6fa009e7 Mon Sep 17 00:00:00 2001 From: Avik Das Date: Mon, 5 Dec 2016 22:41:03 -0800 Subject: [PATCH 6/8] Bump to version 2.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 720f88c..d4f35d4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "replayer", "author": "Avik Das ", - "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", From 71c2cbee8059cb5b2ba6c093f8a13c0ea8e9b8b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 10 Dec 2016 15:16:24 -0800 Subject: [PATCH 7/8] resolved conflict --- src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.js b/src/util.js index dc30237..1a4104c 100644 --- a/src/util.js +++ b/src/util.js @@ -209,7 +209,7 @@ function touchOnHit(filename) { } filename = filename + '.headers'; - var now = Infinity; // per NodeJS this will correctly set timestamp to Date.now() / 1000 + var now = Date.now() / 1000; if (fs.existsSync(filename)) { fs.utimesSync(filename, now, now); From 0a73de3d1b79bdf565cf049bcbb3d2ef0a78c244 Mon Sep 17 00:00:00 2001 From: Aneil Mallavarapu Date: Sun, 26 Mar 2017 14:39:39 -0700 Subject: [PATCH 8/8] Remove 80 character line limit For now. Will add it back as a separate commit, because it is causing tests to break. --- .jshintrc | 1 - 1 file changed, 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index b91e65b..d59789c 100644 --- a/.jshintrc +++ b/.jshintrc @@ -31,7 +31,6 @@ "laxbreak": false, "laxcomma": false, "loopfunc": false, - "maxlen": 80, "multistr": true, "newcap": false, "noarg": true,