This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: register all auto-imports for mocking (#254)
Co-authored-by: Ghazi <ghazialhouwari@gmail.com>
- Loading branch information
1 parent
fdc4263
commit 8799e6a
Showing
4 changed files
with
37 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { defineNuxtModule } from '@nuxt/kit' | ||
import { defineNuxtModule, createResolver, addImports } from '@nuxt/kit' | ||
|
||
export default defineNuxtModule({ | ||
meta: { | ||
name: 'custom', | ||
}, | ||
setup(_, _nuxt) { | ||
console.log('From custom module!') | ||
}, | ||
|
||
const { resolve } = createResolver(import.meta.url) | ||
|
||
addImports([ | ||
{ | ||
name: 'useCustomModuleAutoImportedTarget', | ||
from: resolve('runtime/composables/auto-import-mock') | ||
}, | ||
{ | ||
name: 'useCustomModuleAutoImportedNonTarget', | ||
from: resolve('runtime/composables/auto-import-mock') | ||
} | ||
]) | ||
} | ||
}) |
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,7 @@ | ||
export function useCustomModuleAutoImportedTarget() { | ||
return 'the original' | ||
} | ||
|
||
export function useCustomModuleAutoImportedNonTarget() { | ||
return 'the original' | ||
} |
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