diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce7f5aeb4..abca19613 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,8 +61,8 @@ jobs: with: node-version: ${{ matrix.node_version }} - - name: Prepack - run: pnpm prepack + - name: Build for test + run: pnpm -r build:test - name: Test run: pnpm ci:test diff --git a/packages/cli/jest.config.js b/packages/cli/jest.config.js index 652de5472..3fd28f230 100644 --- a/packages/cli/jest.config.js +++ b/packages/cli/jest.config.js @@ -1,3 +1,4 @@ +/** @type {import('jest').Config} */ const config = { coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], coverageReporters: ['text-summary', 'lcov'], diff --git a/packages/cli/package.json b/packages/cli/package.json index 4829c6544..b5494624c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -25,7 +25,7 @@ "precommit": "lint-staged", "prepare:package-json": "node -p \"'export const packageJson = ' + JSON.stringify(require('./package.json'), undefined, 2) + ';'\" > src/package-json.ts", "build": "rimraf lib && pnpm prepare:package-json && tsc -p tsconfig.build.json", - "build:test": "rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap", + "build:test": "rimraf lib/ && pnpm prepare:package-json && tsc -p tsconfig.test.json --sourcemap", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental", "start": "node .", "start:dev": "pnpm build && node .", @@ -33,7 +33,7 @@ "lint:report": "pnpm lint --format json --output-file report.json", "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm run test", + "test:ci": "pnpm run test:only", "prepack": "pnpm build" }, "engines": { diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index d706f486e..50fa1e84b 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "lib", "declaration": true, "moduleResolution": "nodenext", - "module": "es2022", + "module": "esnext", "target": "es2022", "types": ["node", "jest"] }, diff --git a/packages/core/package.json b/packages/core/package.json index adc7260d9..36d689e06 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -21,7 +21,7 @@ "start": "NODE_ENV=production node build/index.js", "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm run test --coverage --silent", + "test:ci": "pnpm run test:only --coverage --silent", "test:report": "codecov -F core" }, "dependencies": { diff --git a/packages/core/tsconfig.base.json b/packages/core/tsconfig.base.json index 75db7efcc..247fd3037 100644 --- a/packages/core/tsconfig.base.json +++ b/packages/core/tsconfig.base.json @@ -2,7 +2,7 @@ "extends": "@silverhand/ts-config/tsconfig.base", "compilerOptions": { "moduleResolution": "nodenext", - "module": "es2022", + "module": "esnext", "declaration": false, "outDir": "build", "baseUrl": ".", diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index d11ff0f5b..cb53e05d5 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -15,7 +15,7 @@ "test": "pnpm build && pnpm test:api && pnpm test:ui", "test:api": "pnpm test:only -i ./lib/tests/api", "test:ui": "pnpm test:only -i --config=jest.config.ui.js ./lib/tests/ui", - "lint": "eslint --ext .ts src tests", + "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "start": "pnpm test" }, @@ -27,7 +27,6 @@ "@peculiar/webcrypto": "^1.3.3", "@silverhand/eslint-config": "1.3.0", "@silverhand/essentials": "^1.3.0", - "@silverhand/jest-config": "1.2.2", "@silverhand/ts-config": "1.2.1", "@types/jest": "^29.1.2", "@types/jest-environment-puppeteer": "^5.0.2", @@ -43,7 +42,6 @@ "prettier": "^2.7.1", "puppeteer": "^19.0.0", "text-encoder": "^0.0.4", - "ts-node": "^10.9.1", "typescript": "^4.9.4" }, "engines": { diff --git a/packages/integration-tests/src/tests/api/application.test.ts b/packages/integration-tests/src/tests/api/application.test.ts index 0b27fc79f..a9aed13f6 100644 --- a/packages/integration-tests/src/tests/api/application.test.ts +++ b/packages/integration-tests/src/tests/api/application.test.ts @@ -2,7 +2,12 @@ import { ApplicationType } from '@logto/schemas'; import { demoAppApplicationId } from '@logto/schemas/lib/seeds'; import { HTTPError } from 'got'; -import { createApplication, getApplication, updateApplication, deleteApplication } from '#src/api/index.js'; +import { + createApplication, + getApplication, + updateApplication, + deleteApplication, +} from '#src/api/index.js'; describe('admin console application', () => { it('should get demo app details successfully', async () => { diff --git a/packages/phrases-ui/package.json b/packages/phrases-ui/package.json index 7a5f208cc..04f6f4cdd 100644 --- a/packages/phrases-ui/package.json +++ b/packages/phrases-ui/package.json @@ -23,6 +23,7 @@ "scripts": { "precommit": "lint-staged", "build": "rm -rf lib/ && tsc", + "build:test": "pnpm build", "dev": "tsc --watch --preserveWatchOutput --incremental", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", diff --git a/packages/phrases-ui/tsconfig.json b/packages/phrases-ui/tsconfig.json index b28c5b67e..cd964b281 100644 --- a/packages/phrases-ui/tsconfig.json +++ b/packages/phrases-ui/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "lib", "declaration": true, "moduleResolution": "nodenext", - "module": "es2022" + "module": "esnext" }, "include": ["src"] } diff --git a/packages/phrases/package.json b/packages/phrases/package.json index 75e20b23a..8c0ae5f21 100644 --- a/packages/phrases/package.json +++ b/packages/phrases/package.json @@ -20,6 +20,7 @@ "scripts": { "precommit": "lint-staged", "build": "rm -rf lib/ && tsc", + "build:test": "pnpm build", "dev": "tsc --watch --preserveWatchOutput --incremental", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", diff --git a/packages/phrases/tsconfig.json b/packages/phrases/tsconfig.json index 255f91f40..41e099231 100644 --- a/packages/phrases/tsconfig.json +++ b/packages/phrases/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "lib", "declaration": true, "moduleResolution": "nodenext", - "module": "es2022" + "module": "esnext" }, "include": [ "src" diff --git a/packages/schemas/jest.config.js b/packages/schemas/jest.config.js index 652de5472..3fd28f230 100644 --- a/packages/schemas/jest.config.js +++ b/packages/schemas/jest.config.js @@ -1,3 +1,4 @@ +/** @type {import('jest').Config} */ const config = { coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], coverageReporters: ['text-summary', 'lcov'], diff --git a/packages/schemas/package.json b/packages/schemas/package.json index a4b093f4b..457f716bb 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -20,14 +20,14 @@ "generate": "./generate.sh", "build:alterations": "rm -rf alterations-js && tsc -p tsconfig.build.alterations.json", "build": "pnpm generate && rm -rf lib/ && tsc -p tsconfig.build.json && pnpm build:alterations", - "build:test": "rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap", + "build:test": "pnpm generate && rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "prepack": "pnpm build", "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm run test" + "test:ci": "pnpm run test:only" }, "engines": { "node": "^16.13.0 || ^18.12.0" diff --git a/packages/schemas/tsconfig.json b/packages/schemas/tsconfig.json index f07ef0259..05e3acb09 100644 --- a/packages/schemas/tsconfig.json +++ b/packages/schemas/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "lib", "declaration": true, "moduleResolution": "nodenext", - "module": "es2022" + "module": "esnext" }, "include": [ "src", diff --git a/packages/shared/jest.config.js b/packages/shared/jest.config.js index 652de5472..3fd28f230 100644 --- a/packages/shared/jest.config.js +++ b/packages/shared/jest.config.js @@ -1,3 +1,4 @@ +/** @type {import('jest').Config} */ const config = { coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], coverageReporters: ['text-summary', 'lcov'], diff --git a/packages/shared/package.json b/packages/shared/package.json index 3a30ecc66..39e8b1601 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -29,7 +29,7 @@ "prepack": "pnpm build", "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm run test" + "test:ci": "pnpm run test:only" }, "devDependencies": { "@silverhand/eslint-config": "1.3.0", diff --git a/packages/shared/src/database/utils.test.ts b/packages/shared/src/database/utils.test.ts index 27937c833..9199c1021 100644 --- a/packages/shared/src/database/utils.test.ts +++ b/packages/shared/src/database/utils.test.ts @@ -11,6 +11,8 @@ import { conditionalSql, } from './utils.js'; +const { jest } = import.meta; + describe('conditionalSql()', () => { it('returns empty sql when value is falsy', () => { expect(conditionalSql(false, () => sql`select 1`)).toEqual({ diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index fd9fd4d6f..b41cf6355 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -5,7 +5,7 @@ "declaration": true, "types": ["node", "jest"], "moduleResolution": "nodenext", - "module": "es2022" + "module": "esnext" }, "include": [ "src" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd5b3409e..582774ba1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -476,7 +476,6 @@ importers: '@peculiar/webcrypto': ^1.3.3 '@silverhand/eslint-config': 1.3.0 '@silverhand/essentials': ^1.3.0 - '@silverhand/jest-config': 1.2.2 '@silverhand/ts-config': 1.2.1 '@types/jest': ^29.1.2 '@types/jest-environment-puppeteer': ^5.0.2 @@ -492,7 +491,6 @@ importers: prettier: ^2.7.1 puppeteer: ^19.0.0 text-encoder: ^0.0.4 - ts-node: ^10.9.1 typescript: ^4.9.4 devDependencies: '@jest/types': 29.1.2 @@ -502,7 +500,6 @@ importers: '@peculiar/webcrypto': 1.3.3 '@silverhand/eslint-config': 1.3.0_eu7dlo3qq5moigliolva3udaxa '@silverhand/essentials': 1.3.0 - '@silverhand/jest-config': 1.2.2_ky6c64xxalg2hsll4xx3evq2dy '@silverhand/ts-config': 1.2.1_typescript@4.9.4 '@types/jest': 29.1.2 '@types/jest-environment-puppeteer': 5.0.2 @@ -510,7 +507,7 @@ importers: dotenv: 16.0.0 eslint: 8.21.0 got: 12.5.3 - jest: 29.1.2_k5ytkvaprncdyzidqqws5bqksq + jest: 29.1.2_@types+node@16.11.12 jest-puppeteer: 6.1.1_puppeteer@19.2.2 node-fetch: 2.6.7 openapi-schema-validator: 12.0.0 @@ -518,7 +515,6 @@ importers: prettier: 2.7.1 puppeteer: 19.2.2 text-encoder: 0.0.4 - ts-node: 10.9.1_ace2mtubvwruu4qt46fm3vtq3a typescript: 4.9.4 packages/phrases: