-
Notifications
You must be signed in to change notification settings - Fork 107
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
Local caching #78
Local caching #78
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful!
} | ||
}); | ||
|
||
test.run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could either this test or the optimize-cp test receive an empty string as a path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test that it just treats ""
as its own thing, which is what it does right now. I'm not 100% sure what the correct thing is there.
I guess ""
could mean the root directory, and then in the mkdir case it should always get removed if there are any other directories, and in the copy case it would always win over any other entries.
I'm not sure it can happen in practice given the current implementation.
@@ -8,6 +8,7 @@ import {WireitError} from './error.js'; | |||
import {DefaultLogger} from './logging/default-logger.js'; | |||
import {Analyzer} from './analyzer.js'; | |||
import {Executor} from './executor.js'; | |||
import {LocalCache} from './caching/local-cache.js'; | |||
|
|||
const packageDir = process.env.npm_config_local_prefix; | |||
const logger = new DefaultLogger(packageDir ?? process.cwd()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check to see if the current node is >= our minimum version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have the engines
check already, which will warn on install. I feel like that's ok for now.
// | ||
// Convert Windows-style paths to POSIX-style paths if we are on | ||
// Windows, because fast-glob only understands POSIX-style paths. | ||
posixifyPathIfOnWindows( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to glob the replay paths, or should those be outside the call to glob?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm including them in glob because that's an easy way to only include them if they exist. Added a comment.
assert.not(await rig.exists('output/1/c/d/e')); | ||
assert.equal(await rig.read('output/0/a'), 'v0'); | ||
assert.equal(await rig.read('output/0/b'), 'v0'); | ||
assert.equal(await rig.read('output/0/c/d/e'), 'v0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also assert that the excluded file still exists and still has the expected contents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// Previous output should be deleted. | ||
assert.not(await rig.exists('output/0/a')); | ||
assert.not(await rig.exists('output/0/b')); | ||
assert.not(await rig.exists('output/0/c/d/e')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert that the excluded file is still present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
- Adds the missing `test:local-cache` script, which I forgot to include in the merge between #84 and #78. - Bump the version of `wireit` we are building ourselves with. - Set `WIREIT_PARALLEL=1` for now, because it's difficult to read the test output when stdio is interleaved (I'm planning a fix for that soon, where we only allow one process at a time to write to stdio).
Script output is now saved and restored using a local cache directory:
This includes all
output
files, plus thestdout
andstderr
replays.Fixes #12
Related upcoming work