1
1
import path from 'path'
2
- import { cosmiconfigSync as cosmiconfigSyncMock } from 'cosmiconfig '
2
+ import { lilconfigSync as lilconfigSyncMock } from 'lilconfig '
3
3
import cpy from 'cpy'
4
4
import babel from '@babel/core'
5
5
import pluginTester from 'babel-plugin-tester'
6
6
import plugin from '../'
7
7
8
8
const projectRoot = path . join ( __dirname , '../../' )
9
9
10
- jest . mock ( 'cosmiconfig ' , ( ) => {
11
- const cosmiconfigExports = jest . requireActual ( 'cosmiconfig ' )
12
- const actualCosmiconfigSync = cosmiconfigExports . cosmiconfigSync
13
- function fakeCosmiconfigSync ( ...args ) {
14
- fakeCosmiconfigSync . explorer = actualCosmiconfigSync ( ...args )
15
- return fakeCosmiconfigSync . explorer
10
+ jest . mock ( 'lilconfig ' , ( ) => {
11
+ const lilconfigExports = jest . requireActual ( 'lilconfig ' )
12
+ const actualLilconfigSync = lilconfigExports . lilconfigSync
13
+ function fakeLilconfigSync ( ...args ) {
14
+ fakeLilconfigSync . explorer = actualLilconfigSync ( ...args )
15
+ return fakeLilconfigSync . explorer
16
16
}
17
- return { ...cosmiconfigExports , cosmiconfigSync : fakeCosmiconfigSync }
17
+ return { ...lilconfigExports , lilconfigSync : fakeLilconfigSync }
18
18
} )
19
19
20
20
beforeAll ( ( ) => {
@@ -296,9 +296,9 @@ pluginTester({
296
296
fixture : path . join ( __dirname , 'fixtures/config/code.js' ) ,
297
297
setup ( ) {
298
298
jest
299
- . spyOn ( cosmiconfigSyncMock . explorer , 'search' )
299
+ . spyOn ( lilconfigSyncMock . explorer , 'search' )
300
300
. mockImplementationOnce ( ( ) => {
301
- throw new Error ( 'this is a cosmiconfig error' )
301
+ throw new Error ( 'this is a lilconfig error' )
302
302
} )
303
303
jest . spyOn ( console , 'error' ) . mockImplementationOnce ( ( ) => { } )
304
304
return function teardown ( ) {
@@ -319,7 +319,7 @@ pluginTester({
319
319
fixture : path . join ( __dirname , 'fixtures/config/code.js' ) ,
320
320
setup ( ) {
321
321
jest
322
- . spyOn ( cosmiconfigSyncMock . explorer , 'search' )
322
+ . spyOn ( lilconfigSyncMock . explorer , 'search' )
323
323
. mockImplementationOnce ( ( ) => {
324
324
return null
325
325
} )
0 commit comments