tests: reorganize Jest configuration and VSCode settings for improved testing setup
This commit is contained in:
parent
4b9c5dbdd1
commit
f4376934d7
8
meet-ce/.vscode/settings.json
vendored
Normal file
8
meet-ce/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"jest.jestCommandLine": "node --experimental-vm-modules ../../node_modules/.bin/jest",
|
||||||
|
"jest.rootPath": "backend",
|
||||||
|
"jest.nodeEnv": {
|
||||||
|
"NODE_OPTIONS": "--experimental-vm-modules"
|
||||||
|
},
|
||||||
|
"jest.runMode": "on-demand"
|
||||||
|
}
|
||||||
62
meet-ce/backend/.vscode/launch.json
vendored
62
meet-ce/backend/.vscode/launch.json
vendored
@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Debug Jest Test",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
||||||
"args": [
|
|
||||||
"--config",
|
|
||||||
"jest.config.mjs",
|
|
||||||
"--runInBand",
|
|
||||||
"--no-cache",
|
|
||||||
"${file}"
|
|
||||||
],
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
"internalConsoleOptions": "neverOpen",
|
|
||||||
"disableOptimisticBPs": true,
|
|
||||||
"windows": {
|
|
||||||
"program": "${workspaceFolder}/node_modules/.bin/jest.cmd"
|
|
||||||
},
|
|
||||||
"runtimeArgs": [
|
|
||||||
"--experimental-vm-modules"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"NODE_ENV": "test"
|
|
||||||
},
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Debug Current Jest Test",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
||||||
"args": [
|
|
||||||
"--config",
|
|
||||||
"jest.config.mjs",
|
|
||||||
"--runInBand",
|
|
||||||
"--testNamePattern",
|
|
||||||
"${input:testName}",
|
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
"internalConsoleOptions": "neverOpen",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"--experimental-vm-modules"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"NODE_ENV": "test"
|
|
||||||
},
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"id": "testName",
|
|
||||||
"description": "Test name pattern (optional)",
|
|
||||||
"default": "",
|
|
||||||
"type": "promptString"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
5
meet-ce/backend/.vscode/settings.json
vendored
5
meet-ce/backend/.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"jest.jestCommandLine": "node --experimental-vm-modules ./node_modules/.bin/jest --config jest.config.mjs",
|
|
||||||
"jest.rootPath": "./",
|
|
||||||
"jest.runMode": "on-demand"
|
|
||||||
}
|
|
||||||
@ -12,7 +12,7 @@ const jestConfig = {
|
|||||||
extensionsToTreatAsEsm: ['.ts'],
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^@openvidu-meet/typings$': '<rootDir>/../typings/src/index.ts',
|
'^@openvidu-meet/typings$': '<rootDir>/../typings/src/index.ts',
|
||||||
'^(\\.{1,2}/.*)\\.js$': '$1' // Permite importar .js que resuelven a .ts
|
'^(\\.{1,2}/.*)\\.js$': '$1' // Allow importing js files and resolving to ts files
|
||||||
},
|
},
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.tsx?$': ['ts-jest', {
|
'^.+\\.tsx?$': ['ts-jest', {
|
||||||
|
|||||||
8
meet-ce/frontend/.vscode/settings.json
vendored
8
meet-ce/frontend/.vscode/settings.json
vendored
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"prettier.jsxSingleQuote": true,
|
|
||||||
"prettier.singleQuote": true,
|
|
||||||
"javascript.preferences.quoteStyle": "single",
|
|
||||||
"typescript.preferences.quoteStyle": "single",
|
|
||||||
"editor.insertSpaces": false,
|
|
||||||
"prettier.useTabs": true
|
|
||||||
}
|
|
||||||
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"jest.jestCommandLine": "node --experimental-vm-modules ./node_modules/.bin/jest --config jest.config.mjs",
|
"jest.jestCommandLine": "node --experimental-vm-modules ../../../node_modules/.bin/jest --config jest.config.mjs",
|
||||||
"jest.rootPath": "./",
|
"jest.rootPath": ".",
|
||||||
|
"jest.nodeEnv": {
|
||||||
|
"NODE_OPTIONS": "--experimental-vm-modules"
|
||||||
|
},
|
||||||
"jest.runMode": "on-demand"
|
"jest.runMode": "on-demand"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,11 +6,16 @@ const jestConfig = {
|
|||||||
...createDefaultEsmPreset({
|
...createDefaultEsmPreset({
|
||||||
tsconfig: 'tsconfig.json'
|
tsconfig: 'tsconfig.json'
|
||||||
}),
|
}),
|
||||||
|
// Set the root directory to the webcomponent folder
|
||||||
|
rootDir: './',
|
||||||
resolver: 'ts-jest-resolver',
|
resolver: 'ts-jest-resolver',
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
|
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
|
||||||
moduleFileExtensions: ['js', 'ts', 'json', 'node'],
|
moduleFileExtensions: ['js', 'ts', 'json', 'node'],
|
||||||
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/tests/e2e/'],
|
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/tests/e2e/'],
|
||||||
|
transform: {
|
||||||
|
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.json' }]
|
||||||
|
},
|
||||||
globals: {
|
globals: {
|
||||||
'ts-jest': {
|
'ts-jest': {
|
||||||
tsconfig: 'tsconfig.json'
|
tsconfig: 'tsconfig.json'
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
|
// Mock para imports de CSS en tests de Jest
|
||||||
module.exports = ''
|
module.exports = ''
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { describe, expect, it, jest } from '@jest/globals';
|
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||||
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
||||||
import '../../src/index';
|
import '../../src/index';
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { describe, expect, it, jest } from '@jest/globals';
|
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||||
import { CommandsManager } from '../../src/components/CommandsManager';
|
import { CommandsManager } from '../../src/components/CommandsManager';
|
||||||
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
||||||
import '../../src/index';
|
import '../../src/index';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { describe, expect, it, jest } from '@jest/globals';
|
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||||
import { EventsManager } from '../../src/components/EventsManager';
|
import { EventsManager } from '../../src/components/EventsManager';
|
||||||
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
import { OpenViduMeet } from '../../src/components/OpenViduMeet';
|
||||||
import '../../src/index';
|
import '../../src/index';
|
||||||
|
|||||||
@ -42,20 +42,146 @@
|
|||||||
"**/node_modules": true,
|
"**/node_modules": true,
|
||||||
"**/test-results": true,
|
"**/test-results": true,
|
||||||
},
|
},
|
||||||
"jest.disabledWorkspaceFolders": ["openvidu-meet", "typings", "frontend"],
|
"jest.disabledWorkspaceFolders": ["openvidu-meet (root)", "openvidu-components-angular", "shared-meet-components", "meet-testapp"],
|
||||||
"mochaExplorer.files": "tests/e2e/**/*.test.ts",
|
"mochaExplorer.files": "tests/e2e/**/*.test.ts",
|
||||||
"mochaExplorer.require": ".mocharc.js",
|
"mochaExplorer.require": ".mocharc.js",
|
||||||
"files.watcherExclude": {
|
"files.watcherExclude": {
|
||||||
"**/node_modules/**": true,
|
"**/node_modules/**": true,
|
||||||
"**/dist/**": true,
|
"**/dist/**": true,
|
||||||
},
|
},
|
||||||
// "mochaExplorer.files": "./frontend/tests/e2e/**/*.test.ts",
|
|
||||||
// "mochaExplorer.mochaPath": "./frontend/node_modules/mocha",
|
|
||||||
// "mochaExplorer.require": "ts-node/register",
|
|
||||||
// "mochaExplorer.configFile": "./frontend/.mocharc.js",
|
|
||||||
// "mochaExplorer.timeout": 30000,
|
|
||||||
// "mochaExplorer.env": {
|
|
||||||
// "NODE_ENV": "test"
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
}
|
"launch": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Debug Jest Test (CE Backend)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest",
|
||||||
|
"args": [
|
||||||
|
"--config",
|
||||||
|
"${workspaceFolder:openvidu-meet (CE)}/backend/jest.config.mjs",
|
||||||
|
"--runInBand",
|
||||||
|
"--no-cache",
|
||||||
|
"${file}"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"windows": {
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest.cmd"
|
||||||
|
},
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--experimental-vm-modules"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceFolder:openvidu-meet (CE)}/backend"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug Jest Test (PRO Backend)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest",
|
||||||
|
"args": [
|
||||||
|
"--config",
|
||||||
|
"${workspaceFolder:openvidu-meet (PRO)}/backend/jest.config.mjs",
|
||||||
|
"--runInBand",
|
||||||
|
"--no-cache",
|
||||||
|
"${file}"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"windows": {
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest.cmd"
|
||||||
|
},
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--experimental-vm-modules"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceFolder:openvidu-meet (PRO)}/backend"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug Jest Test (Webcomponent)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest",
|
||||||
|
"args": [
|
||||||
|
"--config",
|
||||||
|
"${workspaceFolder:meet-webcomponent}/jest.config.mjs",
|
||||||
|
"--runInBand",
|
||||||
|
"--no-cache",
|
||||||
|
"${file}"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"windows": {
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest.cmd"
|
||||||
|
},
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--experimental-vm-modules"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceFolder:meet-webcomponent}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug Current Jest Test (CE Backend)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest",
|
||||||
|
"args": [
|
||||||
|
"--config",
|
||||||
|
"${workspaceFolder:openvidu-meet (CE)}/backend/jest.config.mjs",
|
||||||
|
"--runInBand",
|
||||||
|
"--testNamePattern",
|
||||||
|
"${input:testName}",
|
||||||
|
"${file}"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--experimental-vm-modules"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceFolder:openvidu-meet (CE)}/backend"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug Current Jest Test (PRO Backend)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder:openvidu-meet (root)}/node_modules/.bin/jest",
|
||||||
|
"args": [
|
||||||
|
"--config",
|
||||||
|
"${workspaceFolder:openvidu-meet (PRO)}/backend/jest.config.mjs",
|
||||||
|
"--runInBand",
|
||||||
|
"--testNamePattern",
|
||||||
|
"${input:testName}",
|
||||||
|
"${file}"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--experimental-vm-modules"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceFolder:openvidu-meet (PRO)}/backend"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"id": "testName",
|
||||||
|
"description": "Test name pattern (optional, leave empty to run all tests in file)",
|
||||||
|
"default": "",
|
||||||
|
"type": "promptString"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -39,6 +39,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browser-sync": "3.0.4",
|
"browser-sync": "3.0.4",
|
||||||
"concurrently": "9.2.1",
|
"concurrently": "9.2.1",
|
||||||
|
"identity-obj-proxy": "3.0.0",
|
||||||
"tree-kill": "1.2.2",
|
"tree-kill": "1.2.2",
|
||||||
"wait-on": "9.0.1"
|
"wait-on": "9.0.1"
|
||||||
}
|
}
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -14,6 +14,9 @@ importers:
|
|||||||
concurrently:
|
concurrently:
|
||||||
specifier: 9.2.1
|
specifier: 9.2.1
|
||||||
version: 9.2.1
|
version: 9.2.1
|
||||||
|
identity-obj-proxy:
|
||||||
|
specifier: 3.0.0
|
||||||
|
version: 3.0.0
|
||||||
tree-kill:
|
tree-kill:
|
||||||
specifier: 1.2.2
|
specifier: 1.2.2
|
||||||
version: 1.2.2
|
version: 1.2.2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user