aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-04-21 20:33:59 +0200
committerGitHub <[email protected]>2022-04-21 18:33:59 +0000
commita28b5deab9079c567b7eb8a1917c661cadd35849 (patch)
tree2a5c67c09186272a85fdbbefc1a889f4877794c9 /test
parentfe8eea46845959d9ad3e9d5f52eb2f35c14977c3 (diff)
downloadfaker-a28b5deab9079c567b7eb8a1917c661cadd35849.tar.xz
faker-a28b5deab9079c567b7eb8a1917c661cadd35849.zip
fix: dont log deprecations on startup (#857)
Diffstat (limited to 'test')
-rw-r--r--test/faker.spec.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/faker.spec.ts b/test/faker.spec.ts
index d8ca61c8..74171210 100644
--- a/test/faker.spec.ts
+++ b/test/faker.spec.ts
@@ -1,4 +1,5 @@
-import { beforeEach, describe, expect, it } from 'vitest';
+import type { SpyInstance } from 'vitest';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
import { faker, Faker } from '../src';
import { FakerError } from '../src/errors/faker-error';
@@ -31,6 +32,24 @@ describe('faker', () => {
);
});
+ it('should not log anything on startup', () => {
+ const spies: Array<SpyInstance> = Object.keys(console)
+ .filter((key) => typeof console[key] === 'function')
+ .map((methodName) =>
+ vi.spyOn(console, methodName as keyof typeof console)
+ );
+
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ require('..').faker;
+
+ new Faker({ locales: { en: { title: '' } } });
+
+ for (const spy of spies) {
+ expect(spy).not.toHaveBeenCalled();
+ spy.mockRestore();
+ }
+ });
+
describe('definitions', () => {
describe('title', () => {
it.each(Object.keys(faker.locales))('title (%s)', (locale) => {