Merge pull request #1795 from github/jest-migration/ts-jest
Use ts-jest for running integration tests
This commit is contained in:
@@ -8,8 +8,8 @@ module.exports = {
|
||||
projects: [
|
||||
"<rootDir>/src/view",
|
||||
"<rootDir>/test",
|
||||
"<rootDir>/out/vscode-tests/cli-integration",
|
||||
"<rootDir>/out/vscode-tests/no-workspace",
|
||||
"<rootDir>/out/vscode-tests/minimal-workspace",
|
||||
"<rootDir>/src/vscode-tests/cli-integration",
|
||||
"<rootDir>/src/vscode-tests/no-workspace",
|
||||
"<rootDir>/src/vscode-tests/minimal-workspace",
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1273,9 +1273,9 @@
|
||||
"test:unit": "jest --projects test",
|
||||
"test:view": "jest --projects src/view",
|
||||
"integration": "npm-run-all integration:*",
|
||||
"integration:no-workspace": "jest --projects out/vscode-tests/no-workspace",
|
||||
"integration:minimal-workspace": "jest --projects out/vscode-tests/minimal-workspace",
|
||||
"cli-integration": "jest --projects out/vscode-tests/cli-integration",
|
||||
"integration:no-workspace": "jest --projects src/vscode-tests/no-workspace",
|
||||
"integration:minimal-workspace": "jest --projects src/vscode-tests/minimal-workspace",
|
||||
"cli-integration": "jest --projects src/vscode-tests/cli-integration",
|
||||
"update-vscode": "node ./node_modules/vscode/bin/install",
|
||||
"format": "prettier --write **/*.{ts,tsx} && eslint . --ext .ts,.tsx --fix",
|
||||
"lint": "eslint . --ext .ts,.tsx --max-warnings=0",
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import * as path from "path";
|
||||
const path = require("path");
|
||||
|
||||
import { RunnerOptions } from "jest-runner-vscode";
|
||||
const {
|
||||
config: baseConfig,
|
||||
rootDir,
|
||||
} = require("../jest-runner-vscode.config.base");
|
||||
|
||||
import baseConfig, { rootDir } from "../jest-runner-vscode.config.base";
|
||||
|
||||
const config: RunnerOptions = {
|
||||
/** @type import("jest-runner-vscode").RunnerOptions */
|
||||
const config = {
|
||||
...baseConfig,
|
||||
launchArgs: [
|
||||
...(baseConfig.launchArgs ?? []),
|
||||
@@ -25,6 +27,4 @@ const config: RunnerOptions = {
|
||||
},
|
||||
};
|
||||
|
||||
// We are purposefully not using export default here since that would result in an ESModule, which doesn't seem to be
|
||||
// supported properly by jest-runner-vscode (cosmiconfig doesn't really seem to support it).
|
||||
module.exports = config;
|
||||
@@ -4,8 +4,8 @@ import baseConfig from "../jest.config.base";
|
||||
|
||||
const config: Config = {
|
||||
...baseConfig,
|
||||
runner: "<rootDir>/jest-runner-cli-integration.js",
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
||||
runner: "<rootDir>/jest-runner-cli-integration.ts",
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -94,7 +94,7 @@ const queryTestCases: QueryTestCase[] = [
|
||||
];
|
||||
|
||||
const db: messages.Dataset = {
|
||||
dbDir: path.join(__dirname, "../test-db"),
|
||||
dbDir: path.join(__dirname, "../../../.vscode-test/test-db"),
|
||||
workingSet: "default",
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as path from "path";
|
||||
import * as tmp from "tmp-promise";
|
||||
import { RunnerOptions } from "jest-runner-vscode";
|
||||
const path = require("path");
|
||||
const tmp = require("tmp-promise");
|
||||
|
||||
export const tmpDir = tmp.dirSync({ unsafeCleanup: true });
|
||||
const tmpDir = tmp.dirSync({ unsafeCleanup: true });
|
||||
|
||||
export const rootDir = path.resolve(__dirname, "../..");
|
||||
const rootDir = path.resolve(__dirname, "../..");
|
||||
|
||||
const config: RunnerOptions = {
|
||||
/** @type import("jest-runner-vscode").RunnerOptions */
|
||||
const config = {
|
||||
version: "stable",
|
||||
launchArgs: [
|
||||
"--disable-gpu",
|
||||
@@ -20,4 +20,8 @@ if (process.env.VSCODE_INSPECTOR_OPTIONS) {
|
||||
config.launchArgs?.push("--inspect-extensions", "9223");
|
||||
}
|
||||
|
||||
export default config;
|
||||
module.exports = {
|
||||
config,
|
||||
tmpDir,
|
||||
rootDir,
|
||||
};
|
||||
@@ -93,7 +93,7 @@ const config: Config = {
|
||||
// notifyMode: "failure-change",
|
||||
|
||||
// A preset that is used as a base for Jest's configuration
|
||||
// preset: 'ts-jest',
|
||||
preset: "ts-jest",
|
||||
|
||||
// Run tests from one or more projects
|
||||
// projects: undefined,
|
||||
@@ -128,7 +128,7 @@ const config: Config = {
|
||||
// setupFiles: [],
|
||||
|
||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||
setupFilesAfterEnv: ["<rootDir>/../jest.setup.js"],
|
||||
setupFilesAfterEnv: ["<rootDir>/../jest.setup.ts"],
|
||||
|
||||
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
||||
// slowTestThreshold: 5,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
const path = require("path");
|
||||
|
||||
const {
|
||||
config: baseConfig,
|
||||
rootDir,
|
||||
} = require("../jest-runner-vscode.config.base");
|
||||
|
||||
/** @type import("jest-runner-vscode").RunnerOptions */
|
||||
const config = {
|
||||
...baseConfig,
|
||||
launchArgs: [
|
||||
...(baseConfig.launchArgs ?? []),
|
||||
"--disable-extensions",
|
||||
path.resolve(rootDir, "test/data"),
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,17 +0,0 @@
|
||||
import * as path from "path";
|
||||
import { RunnerOptions } from "jest-runner-vscode";
|
||||
|
||||
import baseConfig, { rootDir } from "../jest-runner-vscode.config.base";
|
||||
|
||||
const config: RunnerOptions = {
|
||||
...baseConfig,
|
||||
launchArgs: [
|
||||
...(baseConfig.launchArgs ?? []),
|
||||
"--disable-extensions",
|
||||
path.resolve(rootDir, "test/data"),
|
||||
],
|
||||
};
|
||||
|
||||
// We are purposefully not using export default here since that would result in an ESModule, which doesn't seem to be
|
||||
// supported properly by jest-runner-vscode (cosmiconfig doesn't really seem to support it).
|
||||
module.exports = config;
|
||||
@@ -0,0 +1,9 @@
|
||||
const { config: baseConfig } = require("../jest-runner-vscode.config.base");
|
||||
|
||||
/** @type import("jest-runner-vscode").RunnerOptions */
|
||||
const config = {
|
||||
...baseConfig,
|
||||
launchArgs: [...(baseConfig.launchArgs ?? []), "--disable-extensions"],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,12 +0,0 @@
|
||||
import { RunnerOptions } from "jest-runner-vscode";
|
||||
|
||||
import baseConfig from "../jest-runner-vscode.config.base";
|
||||
|
||||
const config: RunnerOptions = {
|
||||
...baseConfig,
|
||||
launchArgs: [...(baseConfig.launchArgs ?? []), "--disable-extensions"],
|
||||
};
|
||||
|
||||
// We are purposefully not using export default here since that would result in an ESModule, which doesn't seem to be
|
||||
// supported properly by jest-runner-vscode (cosmiconfig doesn't really seem to support it).
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user