Skip to content

Commit 44088b1

Browse files
committed
Re-enable ESM
By removing the concept of composites and using simple tsconfig.json
1 parent 11766e3 commit 44088b1

13 files changed

+124
-166
lines changed

__tests__/tsconfig.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

__tests__/tsconfig.test.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

jest.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const pathAliases = {
1515

1616
// See here for more info https://kulshekhar.github.io/ts-jest/docs/getting-started/presets/#advanced
1717
const preset = createDefaultEsmPreset({
18-
tsconfig: './__tests__/tsconfig.test.json',
18+
tsconfig: './tests/tsconfig.json',
1919
});
2020

2121
const config: JestConfigWithTsJest = {
@@ -26,11 +26,7 @@ const config: JestConfigWithTsJest = {
2626
useESM: true,
2727
}),
2828
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/build/'],
29-
testRegex: [
30-
'/tests/.*tests?.[mc]?[jt]sx?$',
31-
'/__tests__/.*tests?.[mc]?[jt]sx?$',
32-
'.*.(spec|test).[mc]?[jt]sx?$',
33-
],
29+
testRegex: ['/tests/.*tests?.[mc]?[jt]sx?$', '.*.(spec|test).[mc]?[jt]sx?$'],
3430
// I dono't think we need to run the spec multiple times.. the functional test on tests/ maybe.
3531
// We can change this back if we consider it useful to run the spec tests when the code is transpiled to javascript
3632
testPathIgnorePatterns: [

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"start": "npm run build && node . serve",
3232
"build:prod:esm": "tsc --build tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
3333
"build:prod:cjs": "tsc --build tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json && cp package.cjs-template.json dist/cjs/package.json",
34-
"build:debug": "tsc --build ./__tests__/tsconfig.test.json && tsc --build ./src/tsconfig.test.json",
34+
"build:debug": "tsc",
35+
"build:debug:test": "tsc --build ./tests/tsconfig.json",
3536
"build:prod": "npm run build:prod:esm && npm run build:prod:cjs",
3637
"watch": "tsc-watch --onSuccess 'node .'",
3738
"lint": "eslint .",
@@ -42,7 +43,7 @@
4243
"check:esmloads": "node -e '(async () => { var o = await import(\"typescript-eslint-prettier-jest-example\"); })();'",
4344
"check:cjsloads": "node -e 'require(\"typescript-eslint-prettier-jest-example\");'",
4445
"check:loads": "npm run check:esmloads && npm run check:cjsloads",
45-
"check:builds": "npm run build:prod && npm run build:debug",
46+
"check:builds": "npm run build:prod && npm run build:debug && npm run build:debug:test",
4647
"check:lint": "npm run lint && npm run format",
4748
"check:all": "npm run check:lint && npm run check:builds && npm run check:loads",
4849
"deps:upgrade": "npm-check -u"

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const server = serverFactory();
66
export { serverFactory };
77

88
if (process.argv[2] === 'serve') {
9-
// eslint-disable-next-line no-console
109
server.listen(PORT, () => {
1110
// eslint-disable-next-line no-console
1211
console.log(`Server running at http://localhost:${PORT}/`);

src/tsconfig.base.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/tsconfig.test.json

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

tests/tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Fake config to satisfy the vscode intellisense
2+
{
3+
"extends": "../tsconfig.json",
4+
"compilerOptions": {
5+
"types": ["node", "jest"],
6+
"allowJs": true,
7+
"sourceMap": true,
8+
},
9+
"include": ["./**/*", "../src/**/*"],
10+
"exclude": ["node_modules", "../*.config.*"],
11+
}

tsconfig.base.json

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)