-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(container-metadata): migrate tests from jest to vitest (#1170)
* test(container-metadata): migrate tests from jest to vitest * test(container-metadata): migrate tests from jest to vitest
- Loading branch information
Showing
13 changed files
with
133 additions
and
81 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 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
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,20 @@ | ||
import * as dotenv from 'dotenv'; | ||
import * as fs from 'node:fs'; | ||
|
||
export const mockConsole = () => { | ||
vi.spyOn(console, 'info').mockImplementation(() => true); | ||
vi.spyOn(console, 'log').mockImplementation(() => true); | ||
vi.spyOn(console, 'warn').mockImplementation(() => true); | ||
}; | ||
|
||
export const stubEnvsFromFile = (path: string) => { | ||
const envs = dotenv.parse(fs.readFileSync(path)); | ||
|
||
Object.keys(envs).forEach((key) => { | ||
vi.stubEnv(key, envs[key]); | ||
}); | ||
}; | ||
|
||
it('should work', () => { | ||
expect(true).toBeTruthy(); | ||
}); |
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,20 @@ | ||
import { defineConfig } from 'vite'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../node_modules/.vite/packages/container-metadata', | ||
plugins: [], | ||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
test: { | ||
watch: false, | ||
globals: true, | ||
environment: 'node', | ||
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
reporters: ['default'], | ||
coverage: { reportsDirectory: '../../coverage/packages/container-metadata', provider: 'v8' }, | ||
pool: 'forks', | ||
}, | ||
}); |