-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Snapshot location #1489
Snapshot location #1489
Changes from 1 commit
f2471c8
2c344fa
5c65c9e
9e98219
548c6b6
d239882
12f1ff8
902f0d3
3ec0217
e3fc508
6282999
de453b3
22838a9
b18db03
61af5da
982a0a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- throw on invalid sourcemap - remove extra snapshot-location cli option
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,8 @@ function tryReadSourceMap(file) { | |
try { | ||
return JSON.parse(content.toString()); | ||
} catch (err) { | ||
console.error('Parse error on sourcemap', file); | ||
return null; | ||
console.error('Parse error on snapshot sourcemap', file); | ||
throw err; | ||
} | ||
} | ||
} | ||
|
@@ -371,7 +371,11 @@ function determineSnapshotDir(options) { | |
const projectDir = options.projectDir; | ||
const testDir = determineSourceMappedDir(options); | ||
if (options.location) { | ||
return testDir; // No need for a preset foldername in custom locations | ||
// "snapshotLocation" in ava package.json config, snapshots derive a location | ||
// relative from the source testDir not the preset "__snapshots__" folder names | ||
const resolvedLocation = path.resolve(options.projectDir, options.location); | ||
const relativeTestLocation = options.testDir.replace(options.projectDir, ''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this refer to Also, you should be able to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please checkout the latest revision. |
||
return path.join(resolvedLocation, relativeTestLocation); | ||
} | ||
const parts = new Set(path.relative(projectDir, testDir).split(path.sep)); | ||
if (parts.has('__tests__')) { | ||
|
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.
When
options.location
becomesoptions.fixedLocation
this comment becomes unnecessary since it's clear what is expected of the code.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.
Good point, I guess the comment highlighted some of the ambiguitiy, please checkout the latest revision.