mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
Fixes #19169 Note, I'm not sure why it was done this way before — e.g. Why `testDir` were considered for resolution, but `testFileDir` wasn't. Looking for guidance on the approach here, because there are still some template tokens outside `path.resolve` Co-authored-by: Shubham Kanodia <skanodia@atlassian.com>
This commit is contained in:
parent
62b28c89b4
commit
4679cfaeb9
@ -246,19 +246,20 @@ export class TestInfoImpl implements TestInfo {
|
||||
const parsedRelativeTestFilePath = path.parse(relativeTestFilePath);
|
||||
const projectNamePathSegment = sanitizeForFilePath(this.project.name);
|
||||
|
||||
const snapshotPath = path.resolve(this.config._configDir, this.project.snapshotPathTemplate
|
||||
const snapshotPath = this.project.snapshotPathTemplate
|
||||
.replace(/\{(.)?testDir\}/g, '$1' + this.project.testDir)
|
||||
.replace(/\{(.)?snapshotDir\}/g, '$1' + this.project.snapshotDir)
|
||||
.replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : ''))
|
||||
.replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '')
|
||||
.replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir)
|
||||
.replace(/\{(.)?platform\}/g, '$1' + process.platform)
|
||||
.replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '')
|
||||
.replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName())
|
||||
.replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir)
|
||||
.replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base)
|
||||
.replace(/\{(.)?testFilePath\}/g, '$1' + relativeTestFilePath)
|
||||
.replace(/\{(.)?arg\}/g, '$1' + path.join(parsedSubPath.dir, parsedSubPath.name))
|
||||
.replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');
|
||||
return path.normalize(snapshotPath);
|
||||
|
||||
return path.normalize(path.resolve(this.config._configDir, snapshotPath));
|
||||
}
|
||||
|
||||
skip(...args: [arg?: any, description?: string]) {
|
||||
|
Loading…
Reference in New Issue
Block a user