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';
9
9
10
10
// populate an object with all basic JavaScript datatypes
11
11
const object = {
12
- species : 'capybara' ,
13
- ok : true ,
14
- i : [ 'pull up' ] ,
12
+ chillness : 100 ,
13
+ flaws : null ,
15
14
hopOut : {
16
15
atThe : 'after party' ,
17
16
when : new Date ( '2000-07-14' ) ,
18
17
} ,
19
- chillness : 100 ,
20
- weight : 9.5 ,
21
- flaws : null ,
18
+ i : [ 'pull up' ] ,
22
19
location : undefined ,
20
+ ok : true ,
21
+ species : 'capybara' ,
22
+ weight : 9.5 ,
23
23
} ;
24
24
25
25
it ( 'serializes regular objects like JSON.stringify' , ( ) => {
@@ -36,9 +36,9 @@ it('serializes errors', () => {
36
36
37
37
expect ( withoutError ) . not . toEqual ( withError ) ;
38
38
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:' ) ;
42
42
43
43
expect ( JSON . parse ( withError ) ) . toMatchObject ( {
44
44
error : {
Original file line number Diff line number Diff line change 13
13
* This function handles the extended serialization wanted above.
14
14
*/
15
15
export default function serializeToJSON (
16
- value : any ,
16
+ value : unknown ,
17
17
space ?: string | number ,
18
18
) : string {
19
19
return JSON . stringify (
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ import collectNodeHandles, {
33
33
type HandleCollectionResult ,
34
34
} from './collectHandles' ;
35
35
import getNoTestsFoundMessage from './getNoTestsFoundMessage' ;
36
+ import serializeToJSON from './lib/serializeToJSON' ;
36
37
import runGlobalHook from './runGlobalHook' ;
37
38
import type { Filter , TestRunData } from './types' ;
38
- import serializeToJSON from './lib/serializeToJSON' ;
39
39
40
40
const getTestPaths = async (
41
41
globalConfig : Config . GlobalConfig ,
@@ -117,17 +117,12 @@ const processResults = async (
117
117
const cwd = tryRealpath ( process . cwd ( ) ) ;
118
118
const filePath = path . resolve ( cwd , outputFile ) ;
119
119
120
- fs . writeFileSync (
121
- filePath ,
122
- `${ jsonString } \n` ,
123
- ) ;
120
+ fs . writeFileSync ( filePath , `${ jsonString } \n` ) ;
124
121
outputStream . write (
125
122
`Test results written to: ${ path . relative ( cwd , filePath ) } \n` ,
126
123
) ;
127
124
} else {
128
- process . stdout . write (
129
- `${ jsonString } \n` ,
130
- ) ;
125
+ process . stdout . write ( `${ jsonString } \n` ) ;
131
126
}
132
127
}
133
128
You can’t perform that action at this time.
0 commit comments