-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
433 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/vest/src/core/isolate/IsolateTest/IsolateTestReconciler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { IsolateSerializer } from 'vestjs-runtime'; | ||
|
||
import { TIsolateSuite } from 'IsolateSuite'; | ||
import { TFieldName, TGroupName } from 'SuiteResultTypes'; | ||
import { Suite } from 'SuiteTypes'; | ||
|
||
export class SuiteSerializer { | ||
static serialize(suite: Suite<TFieldName, TGroupName>) { | ||
return IsolateSerializer.serialize(suite.dump()); | ||
} | ||
|
||
static deserialize( | ||
serialized: string | TIsolateSuite | Record<string, any> | ||
): TIsolateSuite { | ||
return IsolateSerializer.deserialize(serialized) as TIsolateSuite; | ||
} | ||
|
||
static resume( | ||
suite: Suite<TFieldName, TGroupName>, | ||
root: string | TIsolateSuite | Record<string, any> | ||
): void { | ||
const suiteRoot = SuiteSerializer.deserialize(root); | ||
|
||
suite.resume(suiteRoot); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
packages/vest/src/exports/__tests__/SuiteSerializer.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { SuiteSerializer } from 'SuiteSerializer'; | ||
import * as vest from 'vest'; | ||
|
||
describe('SuiteSerializer', () => { | ||
it('Should produce a valid serialized dump', () => { | ||
const suite = vest.create('suite_serialize_test', () => { | ||
vest.only('field_1'); | ||
|
||
vest.test('field_1', 'field_1_message', () => false); | ||
vest.test('field_2', 'field_2_message', () => false); | ||
|
||
vest.group('group_1', () => { | ||
vest.test('field_3', 'field_3_message_1', () => false); | ||
vest.test('field_3', 'field_3_message_2', () => false); | ||
vest.test('field_4', 'field_4_message', () => false); | ||
}); | ||
|
||
vest.skipWhen(false, () => { | ||
vest.test('field_5', 'field_5_message', () => false); | ||
}); | ||
}); | ||
suite(); | ||
|
||
const serialized = SuiteSerializer.serialize(suite); | ||
expect(serialized).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('suite.resume', () => { | ||
it('Should resume a suite from a serialized dump', () => { | ||
const suite = vest.create(() => { | ||
vest.only('field_1'); | ||
|
||
vest.test('field_1', 'field_1_message', () => false); | ||
vest.test('field_2', 'field_2_message', () => false); | ||
|
||
vest.group('group_1', () => { | ||
vest.test('field_3', 'field_3_message_1', () => false); | ||
vest.test('field_3', 'field_3_message_2', () => false); | ||
vest.test('field_4', 'field_4_message', () => false); | ||
}); | ||
|
||
vest.skipWhen(false, () => { | ||
vest.test('field_5', 'field_5_message', () => false); | ||
}); | ||
}); | ||
|
||
suite(); | ||
suite.get(); | ||
|
||
const serialized = SuiteSerializer.serialize(suite); | ||
|
||
const suite2 = vest.create(() => {}); | ||
|
||
suite2(); | ||
|
||
expect(suite.get()).not.toEqual(suite2.get()); | ||
|
||
SuiteSerializer.resume(suite2, serialized); | ||
|
||
expect(suite.get()).isDeepCopyOf(suite2.get()); | ||
|
||
suite2(); | ||
expect(suite.get()).not.toEqual(suite2.get()); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/vest/src/exports/__tests__/__snapshots__/SuiteSerializer.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SuiteSerializer Should produce a valid serialized dump 1`] = `"{"children":[{"$":"Focused","D":{"focusMode":0,"match":["field_1"],"matchAll":false}},{"$":"Test","D":{"severity":"error","status":"FAILED","fieldName":"field_1","message":"field_1_message"}},{"$":"Test","D":{"severity":"error","status":"SKIPPED","fieldName":"field_2","message":"field_2_message"}},{"children":[{"$":"Test","D":{"severity":"error","status":"SKIPPED","fieldName":"field_3","groupName":"group_1","message":"field_3_message_1"}},{"$":"Test","D":{"severity":"error","status":"SKIPPED","fieldName":"field_3","groupName":"group_1","message":"field_3_message_2"}},{"$":"Test","D":{"severity":"error","status":"SKIPPED","fieldName":"field_4","groupName":"group_1","message":"field_4_message"}}],"$":"Group","D":{}},{"children":[{"$":"Test","D":{"severity":"error","status":"SKIPPED","fieldName":"field_5","message":"field_5_message"}}],"$":"SkipWhen","D":{}}],"$":"Suite","D":{"optional":{}},"output":{"errorCount":1,"warnCount":0,"testCount":1,"errors":[{"fieldName":"field_1","message":"field_1_message"}],"warnings":[],"groups":{"group_1":{"field_3":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false},"field_4":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false}}},"tests":{"field_1":{"errorCount":1,"warnCount":0,"testCount":1,"errors":["field_1_message"],"warnings":[],"valid":false},"field_2":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false},"field_3":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false},"field_4":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false},"field_5":{"errorCount":0,"warnCount":0,"testCount":0,"errors":[],"warnings":[],"valid":false}},"valid":false,"suiteName":"suite_serialize_test"}}"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
packages/vest/src/suite/__tests__/__snapshots__/suite.serialize.test.ts.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ src | |
!dist/ | ||
tsconfig.json | ||
!test-utils/ | ||
!IsolateSerializer/ | ||
|
||
# Manual Section. Edit at will. |
Oops, something went wrong.
eee4905
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.
Successfully deployed to the following URLs:
vest – ./website
vestjs.dev
vest-ealush.vercel.app
vest-git-latest-ealush.vercel.app
vest.vercel.app
www.vestjs.dev
eee4905
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.
Successfully deployed to the following URLs:
vest-next – ./website
vest-next-git-latest-ealush.vercel.app
vest-next-ealush.vercel.app
vest-website.vercel.app
vest-next.vercel.app