File tree Expand file tree Collapse file tree 3 files changed +13
-18
lines changed
Expand file tree Collapse file tree 3 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,17 @@ import serializeToJSON from '../serializeToJSON';
99
1010// populate an object with all basic JavaScript datatypes
1111const object = {
12- species : 'capybara' ,
13- ok : true ,
14- i : [ 'pull up' ] ,
12+ chillness : 100 ,
13+ flaws : null ,
1514 hopOut : {
1615 atThe : 'after party' ,
1716 when : new Date ( '2000-07-14' ) ,
1817 } ,
19- chillness : 100 ,
20- weight : 9.5 ,
21- flaws : null ,
18+ i : [ 'pull up' ] ,
2219 location : undefined ,
20+ ok : true ,
21+ species : 'capybara' ,
22+ weight : 9.5 ,
2323} ;
2424
2525it ( 'serializes regular objects like JSON.stringify' , ( ) => {
@@ -36,9 +36,9 @@ it('serializes errors', () => {
3636
3737 expect ( withoutError ) . not . toEqual ( withError ) ;
3838
39- expect ( withError ) . toContain ( ` "message":"too cool"` ) ;
40- expect ( withError ) . toContain ( ` "name":"Error"` ) ;
41- expect ( withError ) . toContain ( ` "stack":"Error:` ) ;
39+ expect ( withError ) . toContain ( ' "message":"too cool"' ) ;
40+ expect ( withError ) . toContain ( ' "name":"Error"' ) ;
41+ expect ( withError ) . toContain ( ' "stack":"Error:' ) ;
4242
4343 expect ( JSON . parse ( withError ) ) . toMatchObject ( {
4444 error : {
Original file line number Diff line number Diff line change 1313 * This function handles the extended serialization wanted above.
1414 */
1515export default function serializeToJSON (
16- value : any ,
16+ value : unknown ,
1717 space ?: string | number ,
1818) : string {
1919 return JSON . stringify (
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ import collectNodeHandles, {
3333 type HandleCollectionResult ,
3434} from './collectHandles' ;
3535import getNoTestsFoundMessage from './getNoTestsFoundMessage' ;
36+ import serializeToJSON from './lib/serializeToJSON' ;
3637import runGlobalHook from './runGlobalHook' ;
3738import type { Filter , TestRunData } from './types' ;
38- import serializeToJSON from './lib/serializeToJSON' ;
3939
4040const getTestPaths = async (
4141 globalConfig : Config . GlobalConfig ,
@@ -117,17 +117,12 @@ const processResults = async (
117117 const cwd = tryRealpath ( process . cwd ( ) ) ;
118118 const filePath = path . resolve ( cwd , outputFile ) ;
119119
120- fs . writeFileSync (
121- filePath ,
122- `${ jsonString } \n` ,
123- ) ;
120+ fs . writeFileSync ( filePath , `${ jsonString } \n` ) ;
124121 outputStream . write (
125122 `Test results written to: ${ path . relative ( cwd , filePath ) } \n` ,
126123 ) ;
127124 } else {
128- process . stdout . write (
129- `${ jsonString } \n` ,
130- ) ;
125+ process . stdout . write ( `${ jsonString } \n` ) ;
131126 }
132127 }
133128
You can’t perform that action at this time.
0 commit comments