aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShinigami <[email protected]>2024-02-18 22:43:16 +0100
committerGitHub <[email protected]>2024-02-18 22:43:16 +0100
commitec5609b18c79ea9fc8183ae78e917801e6a8a3f4 (patch)
tree35999710134991d586ee53d64808e76e351dfa08 /test
parentdb88a1518e8d0ccfe191bd48a1ae8641a9a25303 (diff)
downloadfaker-ec5609b18c79ea9fc8183ae78e917801e6a8a3f4.tar.xz
faker-ec5609b18c79ea9fc8183ae78e917801e6a8a3f4.zip
chore: convert to esm (#2261)
Diffstat (limited to 'test')
-rw-r--r--test/faker.spec.ts5
-rw-r--r--test/locale-imports.spec.ts2
2 files changed, 3 insertions, 4 deletions
diff --git a/test/faker.spec.ts b/test/faker.spec.ts
index a026577b..63ae794e 100644
--- a/test/faker.spec.ts
+++ b/test/faker.spec.ts
@@ -13,15 +13,14 @@ describe('faker', () => {
);
});
- it('should not log anything on startup', () => {
+ it('should not log anything on startup', async () => {
const spies: MockInstance[] = 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, unicorn/prefer-module -- Using import() requires types being build but the CI / TS-Check runs without them.
- require('..').faker;
+ (await import('..')).default;
new Faker({ locale: { metadata: { title: '' } } });
diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts
index 5f07056b..4c1197c8 100644
--- a/test/locale-imports.spec.ts
+++ b/test/locale-imports.spec.ts
@@ -6,7 +6,7 @@ import { keys } from '../src/internal/keys';
describe.each(keys(allLocales))('locale imports', (locale) => {
it(`should be possible to directly require('@faker-js/faker/locale/${locale}')`, () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires, unicorn/prefer-module
- const { faker } = require(`../dist/locale/${locale}`) as {
+ const { faker } = require(`../dist/locale/${locale}.cjs`) as {
faker: Faker;
};