Skip to content

Commit

Permalink
feat(esm): moving backend-benchmarking to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
bassrock committed Jan 3, 2025
1 parent 643df25 commit f5d612d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 10 deletions.
6 changes: 0 additions & 6 deletions packages/backend-benchmarking/jest.config.js

This file was deleted.

23 changes: 23 additions & 0 deletions packages/backend-benchmarking/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Config } from 'jest';

const config: Config = {
preset: 'ts-jest/presets/default-esm', // or other ESM presets
testEnvironment: 'node',
testMatch: ['**/?(*.)+(jest|spec).[jt]s?(x)'],
testPathIgnorePatterns: ['/dist/'],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
transform: {
['^.+.tsx?$']: [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
isolatedModules: true,
useESM: true,
},
],
}
};

export default config;
12 changes: 12 additions & 0 deletions packages/backend-benchmarking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
},
"license": "ISC",
"author": "",
"type": "module",
"exports": {
"import": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand All @@ -32,6 +43,7 @@
"@pocket-tools/eslint-config": "workspace:*",
"@types/jest": "29.5.14",
"@types/node": "^22.8.2",
"@types/chance": "1.1.6",
"jest": "29.7.0",
"ts-jest": "29.2.5",
"ts-node": "10.9.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/backend-benchmarking/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// this is the entry point for the npm package
// anything we want consumable (module, type, class, etc) should be exported here

export * from './timeIt';
export * as seeds from './seeds';
export * from './timeIt.ts';
export * as seeds from './seeds/index.ts';
2 changes: 1 addition & 1 deletion packages/backend-benchmarking/src/seeds/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './list';
export * from './list.ts';
2 changes: 1 addition & 1 deletion packages/backend-benchmarking/src/seeds/list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mockList } from './list';
import { mockList } from './list.ts';

describe('mockList', () => {
it('should produce data when total count is divisible by batch size', () => {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5d612d

Please sign in to comment.