Browse Source

chore: Remove Jest and configs

Michael Bromley 2 years ago
parent
commit
7d15d5d667

+ 0 - 30
e2e-common/jest-config.js

@@ -1,30 +0,0 @@
-const path = require('path');
-const { getPackageDir } = require('./get-package-dir');
-
-const packageArg = process.argv.find(arg => arg.startsWith('--package='));
-// We transfer the CLI argument to the env vars because when Jest runs concurrently,
-// it spawns child processes and the argv array data gets lost, but env vars will persist
-// between the processes.
-process.env.packageArg = packageArg;
-const packageDirname = getPackageDir();
-
-module.exports = {
-    moduleFileExtensions: ['js', 'json', 'ts'],
-    rootDir: packageDirname,
-    testRegex: '.e2e-spec.ts$',
-    maxWorkers: process.env.CI ? 1 : 3,
-    extensionsToTreatAsEsm: ['.ts'],
-    transform: {
-        '^.+\\.ts$': [
-            'ts-jest',
-            {
-                tsconfig: '<rootDir>/config/tsconfig.e2e.json',
-                diagnostics: false,
-                isolatedModules: true,
-                useESM: true,
-            },
-        ],
-    },
-    testEnvironment: 'node',
-    reporters: ['default', path.join(__dirname, 'custom-reporter.js')],
-};

+ 1 - 1
e2e-common/tsconfig.e2e.json

@@ -1,7 +1,7 @@
 {
   "extends": "../tsconfig.json",
   "compilerOptions": {
-    "types": ["jest", "node"],
+    "types": ["node"],
     "lib": ["es2015"],
     "skipLibCheck": true,
     "inlineSourceMap": false,

+ 0 - 3
package.json

@@ -39,7 +39,6 @@
     "@graphql-codegen/typescript-operations": "3.0.1",
     "@graphql-tools/schema": "^9.0.17",
     "@swc/core": "^1.3.38",
-    "@types/jest": "^29.4.0",
     "@types/klaw-sync": "^6.0.0",
     "@types/node": "^14.14.31",
     "concurrently": "^6.0.0",
@@ -48,12 +47,10 @@
     "find": "^0.3.0",
     "graphql": "16.6.0",
     "husky": "^4.3.0",
-    "jest": "^29.4.3",
     "klaw-sync": "^6.0.0",
     "lerna": "^4.0.0",
     "lint-staged": "^10.5.4",
     "prettier": "^2.2.1",
-    "ts-jest": "^29.0.5",
     "ts-node": "^10.9.1",
     "tslint": "^6.1.3",
     "typescript": "4.9.5",

+ 0 - 13
packages/asset-server-plugin/jest.config.js

@@ -1,13 +0,0 @@
-module.exports = {
-    coverageDirectory: "coverage",
-    moduleFileExtensions: [
-        "js",
-        "json",
-        "ts",
-    ],
-    preset: "ts-jest",
-    rootDir: __dirname,
-    transform: {
-        "^.+\\.(t|j)s$": "ts-jest",
-    },
-};

+ 0 - 13
packages/common/jest.config.js

@@ -1,13 +0,0 @@
-module.exports = {
-    coverageDirectory: "coverage",
-    moduleFileExtensions: [
-        "js",
-        "json",
-        "ts",
-    ],
-    preset: "ts-jest",
-    rootDir: __dirname,
-    transform: {
-        "^.+\\.(t|j)s$": "ts-jest",
-    },
-};

+ 2 - 2
packages/core/e2e/customer.e2e-spec.ts

@@ -13,7 +13,7 @@ import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from
 import gql from 'graphql-tag';
 import path from 'path';
 import { vi } from 'vitest';
-import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+import { afterAll, beforeAll, describe, expect, it, Mock } from 'vitest';
 
 import { initialData } from '../../../e2e-common/e2e-initial-data';
 import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config';
@@ -47,7 +47,7 @@ import { ADD_ITEM_TO_ORDER, SET_CUSTOMER } from './graphql/shop-definitions';
 import { assertThrowsWithMessage } from './utils/assert-throws-with-message';
 
 // tslint:disable:no-non-null-assertion
-let sendEmailFn: jest.Mock;
+let sendEmailFn: Mock;
 
 /**
  * This mock plugin simulates an EmailPlugin which would send emails

+ 0 - 18
packages/core/jest.config.js

@@ -1,18 +0,0 @@
-module.exports = {
-    coverageDirectory: 'coverage',
-    moduleFileExtensions: ['js', 'json', 'ts'],
-    preset: 'ts-jest',
-    rootDir: __dirname,
-    roots: ['<rootDir>/src', '<rootDir>/mock-data'],
-    transform: {
-        '^.+\\.(t|j)s$': [
-            'ts-jest',
-            {
-                tsconfig: {
-                    allowJs: true,
-                },
-            },
-        ],
-    },
-    testEnvironment: 'node',
-};

+ 0 - 8
packages/elasticsearch-plugin/e2e/elasticsearch-plugin-uuid.e2e-spec.ts

@@ -18,14 +18,6 @@ import { GetCollectionListQuery } from './graphql/generated-e2e-elasticsearch-pl
 // tslint:disable-next-line:no-var-requires
 const { elasticsearchHost, elasticsearchPort } = require('./constants');
 
-/**
- * The Elasticsearch tests sometimes take a long time in CI due to limited resources.
- * We increase the timeout to 30 seconds to prevent failure due to timeouts.
- */
-if (process.env.CI) {
-    jest.setTimeout(10 * 3000);
-}
-
 // https://github.com/vendure-ecommerce/vendure/issues/494
 describe('Elasticsearch plugin with UuidIdStrategy', () => {
     const { server, adminClient, shopClient } = createTestEnvironment(

+ 0 - 19
packages/elasticsearch-plugin/jest.config.js

@@ -1,19 +0,0 @@
-module.exports = {
-    coverageDirectory: 'coverage',
-    moduleFileExtensions: ['js', 'json', 'ts'],
-    preset: 'ts-jest',
-    rootDir: __dirname,
-    roots: ['<rootDir>/src'],
-    transform: {
-        '^.+\\.(t|j)s$': [
-            'ts-jest',
-            {
-                tsconfig: {
-                    allowJs: true,
-                    skipLibCheck: true,
-                },
-            },
-        ],
-    },
-    testEnvironment: 'node',
-};

+ 0 - 20
packages/email-plugin/jest.config.js

@@ -1,20 +0,0 @@
-module.exports = {
-    coverageDirectory: 'coverage',
-    moduleFileExtensions: ['js', 'json', 'ts'],
-    preset: 'ts-jest',
-    rootDir: __dirname,
-    roots: ['<rootDir>/src'],
-    transform: {
-        '^.+\\.(t|j)s$': [
-            'ts-jest',
-            {
-                isolatedModules: true,
-                tsconfig: {
-                    allowJs: true,
-                    skipLibCheck: true,
-                },
-            },
-        ],
-    },
-    testEnvironment: 'node',
-};

+ 0 - 19
packages/job-queue-plugin/jest.config.js

@@ -1,19 +0,0 @@
-module.exports = {
-    coverageDirectory: 'coverage',
-    moduleFileExtensions: ['js', 'json', 'ts'],
-    preset: 'ts-jest',
-    rootDir: __dirname,
-    roots: ['<rootDir>/src'],
-    transform: {
-        '^.+\\.(t|j)s$': [
-            'ts-jest',
-            {
-                tsconfig: {
-                    allowJs: true,
-                    skipLibCheck: true,
-                },
-            },
-        ],
-    },
-    testEnvironment: 'node',
-};