Skip to content

Commit 02f1cce

Browse files
committed
Fix the failing test.
1 parent f9e1a69 commit 02f1cce

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎core-build/gulp-core-build/src/tasks/JestTask.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,16 @@ export class JestTask extends GulpTask<IJestConfig> {
152152
const pattern: string = path.join(srcRoot, '**/__snapshots__/*.snap');
153153
globby.sync(pattern).forEach(sourceFile => {
154154
const destination: string = sourceFile.replace(srcRoot, destRoot);
155-
const tsDestination: string = destination.replace('.test.js.snap', '.test.ts.snap');
156-
const tsxDestination: string = destination.replace('.test.js.snap', '.test.tsx.snap');
157-
158-
if (this._doesSnapBaseFileExist(tsDestination)) {
155+
const jsDestination: string = destination.replace(/\.test\..+\.snap$/, '.test.js.snap');
156+
const jsxDestination: string = destination.replace(/\.test\..+\.snap$/, '.test.jsx.snap');
157+
const tsDestination: string = destination.replace(/\.test\..+\.snap$/, '.test.ts.snap');
158+
const tsxDestination: string = destination.replace(/\.test\..+\.snap$/, '.test.tsx.snap');
159+
160+
if (this._doesSnapBaseFileExist(jsDestination)) {
161+
fsx.copySync(sourceFile, jsDestination);
162+
} else if (this._doesSnapBaseFileExist(jsxDestination)) {
163+
fsx.copySync(sourceFile, jsxDestination);
164+
} else if (this._doesSnapBaseFileExist(tsDestination)) {
159165
fsx.copySync(sourceFile, tsDestination);
160166
} else if (this._doesSnapBaseFileExist(tsxDestination)) {
161167
fsx.copySync(sourceFile, tsxDestination);

0 commit comments

Comments
 (0)