diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b9623869..064fed06c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,32 +1,78 @@ name: Test - on: pull_request: branches: - main + push: + branches: + - main -concurrency: ${{ github.workflow }}-${{ github.ref }} +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true jobs: - test: - name: Test - timeout-minutes: 20 + determine-packages: + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.set-packages.outputs.packages }} + steps: + - uses: actions/checkout@v4 + - name: Get package names + id: set-packages + run: | + SEARCH_DIRS="plugins utils validate convert enrich import export" + + PACKAGES=$( + for dir in $SEARCH_DIRS; do + if [ -d "$dir" ]; then + find "$dir" -maxdepth 2 -name "package.json" -exec sh -c ' + PACKAGE_NAME=$(jq -r .name {}) + if [ "$PACKAGE_NAME" != "null" ]; then + echo "$PACKAGE_NAME" + fi + ' \; + fi + done | jq -R -s -c 'split("\n")[:-1]' + ) + + echo "packages=$PACKAGES" >> $GITHUB_OUTPUT + echo "Found packages: $PACKAGES" + + test-packages: + needs: determine-packages + name: Test (${{ matrix.package }}) runs-on: ubuntu-latest if: ${{ github.head_ref != 'changeset-release/main' }} + strategy: + matrix: + package: ${{fromJson(needs.determine-packages.outputs.packages)}} + fail-fast: false steps: - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 2 + uses: actions/checkout@v4 - name: Setup Node.js environment - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 cache: 'npm' - name: Install dependencies run: npm ci + - name: Build + run: npx turbo run build + - name: Test - run: npm run test + run: npx turbo run test --filter=${{ matrix.package }} + + test: + needs: test-packages + name: Test + runs-on: ubuntu-latest + steps: + - name: Check test results + run: | + echo "All package tests completed successfully" + exit 0 diff --git a/convert/what3words/jest.config.js b/convert/what3words/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/convert/what3words/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/convert/what3words/package.json b/convert/what3words/package.json index e8335d06d..5480d6b49 100644 --- a/convert/what3words/package.json +++ b/convert/what3words/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", @@ -60,4 +60,4 @@ "devDependencies": { "@flatfile/rollup-config": "0.1.1" } -} \ No newline at end of file +} diff --git a/jest.config.js b/jest.config.js index 888b65654..e93a2c6eb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,8 @@ module.exports = { testEnvironment: 'node', - testRegex: '.*\\.(e2e-)?spec\\.ts$', + // testRegex: '(?/**/**/src/*.spec.ts'], + transform: { '^.+\\.tsx?$': 'ts-jest', }, @@ -12,4 +14,5 @@ module.exports = { testTimeout: 60_000, globalSetup: '/test/setup-global.js', forceExit: true, + passWithNoTests: true, } diff --git a/package.json b/package.json index 2a91d0bef..8e9ab59c1 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,9 @@ ], "scripts": { "clean": "find ./ '(' -name 'node_modules' -o -name 'dist' -o -name '.turbo' -o -name '.parcel-cache' ')' -type d -exec rm -rf {} +", - "test": "turbo build && turbo test --concurrency=1", + "test": "jest --config=./jest.config.js --runInBand", "build": "turbo build", + "turbo:test": "turbo test", "build:prod": "turbo build:prod", "build:clean": "npm run clean && npm i && turbo build", "build:prod:clean": "npm run clean && npm i && turbo build:prod", diff --git a/plugins/autocast/jest.config.js b/plugins/autocast/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/autocast/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/autocast/package.json b/plugins/autocast/package.json index 79402c946..8fc2447b8 100644 --- a/plugins/autocast/package.json +++ b/plugins/autocast/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/automap/jest.config.js b/plugins/automap/jest.config.js new file mode 100644 index 000000000..97444dbb0 --- /dev/null +++ b/plugins/automap/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 90_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/automap/package.json b/plugins/automap/package.json index 2d9162879..0a4b01a0f 100644 --- a/plugins/automap/package.json +++ b/plugins/automap/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/constraints/jest.config.js b/plugins/constraints/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/constraints/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/constraints/package.json b/plugins/constraints/package.json index 2a686f87d..50f8b63d6 100644 --- a/plugins/constraints/package.json +++ b/plugins/constraints/package.json @@ -36,7 +36,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [], "author": "David Boskovic", diff --git a/plugins/constraints/src/external.constraint.e2e.spec.ts b/plugins/constraints/src/external.constraint.e2e.spec.ts index 6f94878c3..1d0f895ac 100644 --- a/plugins/constraints/src/external.constraint.e2e.spec.ts +++ b/plugins/constraints/src/external.constraint.e2e.spec.ts @@ -42,7 +42,9 @@ describe('externalConstraint()', () => { it('correctly assigns an error', async () => { await createRecords(sheetId, defaultSimpleValueData) - await listener.waitFor('commit:created') + await listener.waitFor('commit:created', 2) + // Sleep for 1000ms to allow time for the constraint to be applied + // await new Promise(resolve => setTimeout(resolve, 1000)); const records = await getRecords(sheetId) expect(records[0].values['name'].messages[0]).toMatchObject({ type: 'error', diff --git a/plugins/constraints/src/external.sheet.constraint.e2e.spec.ts b/plugins/constraints/src/external.sheet.constraint.e2e.spec.ts index 641ef34be..5b8d2b36f 100644 --- a/plugins/constraints/src/external.sheet.constraint.e2e.spec.ts +++ b/plugins/constraints/src/external.sheet.constraint.e2e.spec.ts @@ -50,7 +50,7 @@ describe('externalConstraint()', () => { it('correctly handles thrown errors', async () => { await createRecords(sheetId, defaultSimpleValueData) - await listener.waitFor('commit:created') + await listener.waitFor('commit:created', 2) const records = await getRecords(sheetId) expect(records[0].values['name'].messages[0]).toMatchObject({ type: 'error', diff --git a/plugins/dedupe/jest.config.js b/plugins/dedupe/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/dedupe/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/dedupe/package.json b/plugins/dedupe/package.json index f2dd8f660..0f258cb3e 100644 --- a/plugins/dedupe/package.json +++ b/plugins/dedupe/package.json @@ -36,7 +36,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/delimiter-extractor/jest.config.js b/plugins/delimiter-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/delimiter-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/delimiter-extractor/package.json b/plugins/delimiter-extractor/package.json index 44dcbb4a5..b0a7ba6b6 100644 --- a/plugins/delimiter-extractor/package.json +++ b/plugins/delimiter-extractor/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/dxp-configure/jest.config.js b/plugins/dxp-configure/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/dxp-configure/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/dxp-configure/package.json b/plugins/dxp-configure/package.json index 9e6130be2..b88d9a472 100644 --- a/plugins/dxp-configure/package.json +++ b/plugins/dxp-configure/package.json @@ -42,7 +42,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/export-workbook/jest.config.js b/plugins/export-workbook/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/export-workbook/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/foreign-db-extractor/jest.config.cjs b/plugins/foreign-db-extractor/jest.config.cjs new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/foreign-db-extractor/jest.config.cjs @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/graphql-schema/jest.config.cjs b/plugins/graphql-schema/jest.config.cjs new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/graphql-schema/jest.config.cjs @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/graphql-schema/package.json b/plugins/graphql-schema/package.json index f17f0fd3a..cf8333579 100644 --- a/plugins/graphql-schema/package.json +++ b/plugins/graphql-schema/package.json @@ -27,7 +27,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [], "author": "Flatfile, Inc.", diff --git a/plugins/job-handler/jest.config.js b/plugins/job-handler/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/job-handler/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/job-handler/package.json b/plugins/job-handler/package.json index 8e05fefdf..f68c1a402 100644 --- a/plugins/job-handler/package.json +++ b/plugins/job-handler/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/json-extractor/jest.config.cjs b/plugins/json-extractor/jest.config.cjs new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/json-extractor/jest.config.cjs @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/json-extractor/package.json b/plugins/json-extractor/package.json index 3aa2bcdf9..8ecdedd32 100644 --- a/plugins/json-extractor/package.json +++ b/plugins/json-extractor/package.json @@ -38,7 +38,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/json-schema/jest.config.js b/plugins/json-schema/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/json-schema/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/json-schema/package.json b/plugins/json-schema/package.json index 815a16d41..a755ecc62 100644 --- a/plugins/json-schema/package.json +++ b/plugins/json-schema/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/merge-connection/jest.config.js b/plugins/merge-connection/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/merge-connection/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/openapi-schema/jest.config.js b/plugins/openapi-schema/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/openapi-schema/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/openapi-schema/package.json b/plugins/openapi-schema/package.json index c129ccd4b..db6789306 100644 --- a/plugins/openapi-schema/package.json +++ b/plugins/openapi-schema/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/pdf-extractor/jest.config.js b/plugins/pdf-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/pdf-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/psv-extractor/jest.config.js b/plugins/psv-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/psv-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/record-hook/jest.config.js b/plugins/record-hook/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/record-hook/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/record-hook/package.json b/plugins/record-hook/package.json index 399934df6..133906d0b 100644 --- a/plugins/record-hook/package.json +++ b/plugins/record-hook/package.json @@ -42,7 +42,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts --detectOpenHandles" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/record-hook/src/RecordHook.e2e.spec.ts b/plugins/record-hook/src/RecordHook.e2e.spec.ts index b753b0a99..1d779b914 100644 --- a/plugins/record-hook/src/RecordHook.e2e.spec.ts +++ b/plugins/record-hook/src/RecordHook.e2e.spec.ts @@ -309,6 +309,8 @@ describe('RecordHook e2e', () => { await createRecords(sheetId, [{ email: 'john@doe.com' }]) await listener.waitFor('commit:created') + // Sleep for 500ms to allow time for the bulk record hook to be applied + await new Promise(resolve => setTimeout(resolve, 500)); const records = await getRecords(sheetId) diff --git a/plugins/rollout/jest.config.js b/plugins/rollout/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/rollout/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/rollout/package.json b/plugins/rollout/package.json index 17f67e346..1d2fb3baa 100644 --- a/plugins/rollout/package.json +++ b/plugins/rollout/package.json @@ -21,7 +21,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/space-configure/jest.config.js b/plugins/space-configure/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/space-configure/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/space-configure/package.json b/plugins/space-configure/package.json index aed74120d..9b88ffc53 100644 --- a/plugins/space-configure/package.json +++ b/plugins/space-configure/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/sql-ddl-converter/jest.config.js b/plugins/sql-ddl-converter/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/sql-ddl-converter/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/tsv-extractor/jest.config.js b/plugins/tsv-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/tsv-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/view-mapped/jest.config.js b/plugins/view-mapped/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/view-mapped/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/view-mapped/package.json b/plugins/view-mapped/package.json index bbb0d6c0b..607ebebe8 100644 --- a/plugins/view-mapped/package.json +++ b/plugins/view-mapped/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/webhook-egress/jest.config.js b/plugins/webhook-egress/jest.config.js new file mode 100644 index 000000000..97444dbb0 --- /dev/null +++ b/plugins/webhook-egress/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 90_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/webhook-egress/package.json b/plugins/webhook-egress/package.json index e5f028ccf..29ca42a8f 100644 --- a/plugins/webhook-egress/package.json +++ b/plugins/webhook-egress/package.json @@ -37,7 +37,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/webhook-event-forwarder/jest.config.js b/plugins/webhook-event-forwarder/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/webhook-event-forwarder/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/webhook-event-forwarder/package.json b/plugins/webhook-event-forwarder/package.json index 39431fc4a..1671cf6d4 100644 --- a/plugins/webhook-event-forwarder/package.json +++ b/plugins/webhook-event-forwarder/package.json @@ -36,7 +36,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [], "author": "Morgan Daley", diff --git a/plugins/xlsx-extractor/jest.config.js b/plugins/xlsx-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/xlsx-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/xlsx-extractor/package.json b/plugins/xlsx-extractor/package.json index 14404b7f2..6ae2b9973 100644 --- a/plugins/xlsx-extractor/package.json +++ b/plugins/xlsx-extractor/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/xml-extractor/jest.config.js b/plugins/xml-extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/xml-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/xml-extractor/package.json b/plugins/xml-extractor/package.json index c4498da42..2378dcac7 100644 --- a/plugins/xml-extractor/package.json +++ b/plugins/xml-extractor/package.json @@ -17,7 +17,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/yaml-schema/jest.config.js b/plugins/yaml-schema/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/plugins/yaml-schema/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/yaml-schema/package.json b/plugins/yaml-schema/package.json index 6662b68f4..c79e431f3 100644 --- a/plugins/yaml-schema/package.json +++ b/plugins/yaml-schema/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/plugins/zip-extractor/jest.config.js b/plugins/zip-extractor/jest.config.js new file mode 100644 index 000000000..97444dbb0 --- /dev/null +++ b/plugins/zip-extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 90_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/plugins/zip-extractor/package.json b/plugins/zip-extractor/package.json index 6cfb9a056..b9d583e88 100644 --- a/plugins/zip-extractor/package.json +++ b/plugins/zip-extractor/package.json @@ -18,7 +18,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "keywords": [ "flatfile-plugins", diff --git a/support/common-utils/package.json b/support/common-utils/package.json index 834784009..f8b98c978 100644 --- a/support/common-utils/package.json +++ b/support/common-utils/package.json @@ -21,7 +21,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "repository": { "type": "git", diff --git a/turbo.json b/turbo.json index 7cdb5c0aa..6dcafd344 100644 --- a/turbo.json +++ b/turbo.json @@ -10,7 +10,7 @@ "dependsOn": ["^build:prod"] }, "test": { - "inputs": ["**/*.spec.ts"] + "cache": false } } } diff --git a/utils/common/jest.config.js b/utils/common/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/common/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/common/package.json b/utils/common/package.json index 026db0516..2edadd936 100644 --- a/utils/common/package.json +++ b/utils/common/package.json @@ -35,7 +35,7 @@ "build:watch": "rollup -c --watch", "build:prod": "NODE_ENV=production rollup -c", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" + "test": "jest src/*.spec.ts" }, "repository": { "type": "git", diff --git a/utils/extractor/jest.config.js b/utils/extractor/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/extractor/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/fetch-schema/jest.config.js b/utils/fetch-schema/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/fetch-schema/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/file-buffer/jest.config.js b/utils/file-buffer/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/file-buffer/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/response-rejection/jest.config.js b/utils/response-rejection/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/response-rejection/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/testing/jest.config.js b/utils/testing/jest.config.js new file mode 100644 index 000000000..e6d7ca40b --- /dev/null +++ b/utils/testing/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + testEnvironment: 'node', + + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + setupFiles: ['../../test/dotenv-config.js'], + setupFilesAfterEnv: [ + '../../test/betterConsoleLog.js', + '../../test/unit.cleanup.js', + ], + testTimeout: 60_000, + globalSetup: '../../test/setup-global.js', + forceExit: true, + passWithNoTests: true, +} diff --git a/utils/testing/package.json b/utils/testing/package.json index 784f92df3..f3d4dcfe6 100644 --- a/utils/testing/package.json +++ b/utils/testing/package.json @@ -14,7 +14,7 @@ "build:watch": "parcel watch", "build:prod": "NODE_ENV=production parcel build", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", - "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand --detectOpenHandles" + "test": "jest src/*.spec.ts" }, "author": "Carl Brugger", "repository": {