Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test folders #155

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lsp/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "Client for the Salesforce Mobile Language Server, enabling language support for mobile development in VSCode.",
"license": "MIT",
"version": "0.0.1",
"main": "out/extension.js",
"types": "out/src/extension.d.ts",
"main": "out/src/extension.js",
"publisher": "salesforce",
"engines": {
"vscode": "1.77.0"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lsp/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"target": "es2020",
"lib": ["es2020"],
"outDir": "out",
"rootDir": "src",
"rootDir": ".",
"sourceMap": true,
"composite": true
},
"include": ["src"],
"include": ["src", "test"],
"exclude": ["node_modules", ".vscode-test"]
}
3 changes: 2 additions & 1 deletion lsp/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"engines": {
"node": "*"
},
"main": "out/index.js",
"types": "out/src/index.d.ts",
"main": "out/src/index.js",
"publisher": "salesforce",
"dependencies": {
"@babel/traverse": "^7.25.9",
Expand Down
2 changes: 1 addition & 1 deletion lsp/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

export { TempProjectDirManager } from './test/TestHelper';
export { TempProjectDirManager } from '../test/TestHelper';
export { CORE_EXTENSION_ID, SFDX_PROJECT_FILE } from './utils/constants';
5 changes: 2 additions & 3 deletions lsp/server/src/validator/htmlValidator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { TextDocument } from 'vscode-languageserver-textdocument';
import { BaseValidator } from './baseValidator';

import { DiagnosticSection } from './baseValidator';
import { BaseValidator, DiagnosticSection } from './baseValidator';
import { HTMLDocument, getLanguageService } from 'vscode-html-languageservice';

export class HTMLValidator extends BaseValidator<HTMLDocument> {
gatherDiagnosticSections(
textDocument: TextDocument
Expand Down
3 changes: 1 addition & 2 deletions lsp/server/src/validator/jsValidator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { TextDocument } from 'vscode-languageserver-textdocument';
import { BaseValidator } from './baseValidator';
import { BaseValidator, DiagnosticSection } from './baseValidator';
import type { Node } from '@babel/types';
import { parseJs } from '../utils/babelUtil';
import { DiagnosticSection } from './baseValidator';

export class JSValidator extends BaseValidator<Node> {
gatherDiagnosticSections(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import * as os from 'os';
import * as path from 'path';
import * as process from 'process';
import * as sinon from 'sinon';
import Account from '../../testFixture/objectInfos/Account.json';
import Account from '../testFixture/objectInfos/Account.json';
import {
ConfigAggregator,
StateAggregator,
Connection,
AuthInfo
} from '@salesforce/core';
import { WorkspaceUtils } from '../utils/workspaceUtils';
import { WorkspaceUtils } from '../src/utils/workspaceUtils';

const testOrgConfig = {
key: 'target-org',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { TextDocument } from 'vscode-languageserver-textdocument';
import { suite, test, beforeEach, afterEach } from 'mocha';
import Book__c from '../../../../testFixture/objectInfos/Book__c.json';
import Book__c from '../../../testFixture/objectInfos/Book__c.json';
import * as assert from 'assert';
import * as sinon from 'sinon';

Expand All @@ -16,10 +16,10 @@ import {
OversizedRecord,
OVER_SIZED_FIELD_MESSAGE,
OVER_SIZED_RECORD_MESSAGE
} from '../../../diagnostic/gql/over-sized-record';
import { OrgUtils } from '../../../utils/orgUtils';
} from '../../../src/diagnostic/gql/over-sized-record';
import { OrgUtils } from '../../../src/utils/orgUtils';

import { ObjectInfoRepresentation } from '../../../types';
import { ObjectInfoRepresentation } from '../../../src/types';

suite(
'GraphQL Diagnostics Test Suite - Server - Oversized GraphQL Field',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
URL_FOR_GET_RELATED_LIST_RECORDS_EXTERNAL_DOC,
MESSAGE_FOR_GET_RELATED_LIST_RECORDS,
MESSAGE_FOR_GET_RELATED_LIST_COUNT
} from '../../../diagnostic/js/adapters-local-change-not-aware';
import { parseJs } from '../../../utils/babelUtil';
} from '../../../src/diagnostic/js/adapters-local-change-not-aware';
import { parseJs } from '../../../src/utils/babelUtil';
import { TextDocument } from 'vscode-languageserver-textdocument';

suite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
import { suite, test, afterEach } from 'mocha';
import { parseJs } from '../../utils/babelUtil';
import { parseJs } from '../../src/utils/babelUtil';

suite('BabelUtil Test Suite - Server', () => {
afterEach(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

import { TextDocument } from 'vscode-languageserver-textdocument';
import { suite, test, beforeEach, afterEach } from 'mocha';
import Account from '../../../testFixture/objectInfos/Account.json';
import User from '../../../testFixture/objectInfos/User.json';
import Contact from '../../../testFixture/objectInfos/Contact.json';
import Account from '../../testFixture/objectInfos/Account.json';
import User from '../../testFixture/objectInfos/User.json';
import Contact from '../../testFixture/objectInfos/Contact.json';

import * as assert from 'assert';
import * as sinon from 'sinon';

import { parse } from 'graphql';
import { OrgUtils } from '../../utils/orgUtils';
import { generateEntityTree } from '../../utils/gqlUtils';
import { OperationNode, Relation } from '../../utils/gqlUtils';
import { OrgUtils } from '../../src/utils/orgUtils';
import { generateEntityTree } from '../../src/utils/gqlUtils';
import { OperationNode, Relation } from '../../src/utils/gqlUtils';

import { ObjectInfoRepresentation } from '../../types';
import { ObjectInfoRepresentation } from '../../src/types';
suite('GraphQL Utils Test Suite - Server', () => {
let sandbox: sinon.SinonSandbox;
beforeEach(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
import { suite, test, beforeEach, afterEach } from 'mocha';
import { OrgUtils } from '../../utils/orgUtils';
import { OrgUtils } from '../../src/utils/orgUtils';

import {
setupTempWorkspaceDirectoryStub,
Expand All @@ -17,7 +17,7 @@ import {
stubGetInstanceState,
stubCreateConfig
} from '../TestHelper';
import { ObjectInfoRepresentation } from '../../types';
import { ObjectInfoRepresentation } from '../../src/types';

suite('OrgUtils Test Suite - Server', () => {
let sandbox: sinon.SinonSandbox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import * as assert from 'assert';
import * as path from 'path';
import * as fs from 'fs';
import { mkdir } from 'fs/promises';
import { WorkspaceUtils } from '../../utils/workspaceUtils';
import { WorkspaceUtils } from '../../src/utils/workspaceUtils';
import {
TempProjectDirManager,
setupTempWorkspaceDirectoryStub
} from '../TestHelper';
import { suite, test, afterEach, beforeEach } from 'mocha';
import * as sinon from 'sinon';
import { SFDX_PROJECT_FILE } from '../../utils/constants';
import { SFDX_PROJECT_FILE } from '../../src/utils/constants';

suite('Workspace Test Suite - Server', () => {
let getWorkspaceDirStub: sinon.SinonStub<[], string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
import { suite, test, afterEach } from 'mocha';
import { transformYamlToObject } from '../../utils/yamlParser';
import { transformYamlToObject } from '../../src/utils/yamlParser';

suite('YamlParser Test Suite', () => {
afterEach(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
*/

import { TextDocument } from 'vscode-languageserver-textdocument';
import { GraphQLValidator } from '../../validator/gqlValidator';
import { GraphQLValidator } from '../../src/validator/gqlValidator';
import {
OversizedRecord,
RULE_ID
} from '../../diagnostic/gql/over-sized-record';
} from '../../src/diagnostic/gql/over-sized-record';

import * as assert from 'assert';
import { suite, test, beforeEach, afterEach } from 'mocha';
import * as sinon from 'sinon';
import { OrgUtils } from '../../utils/orgUtils';
import Book__c from '../../../testFixture/objectInfos/Book__c.json';
import { ObjectInfoRepresentation } from '../../types';
import { OrgUtils } from '../../src/utils/orgUtils';
import Book__c from '../../testFixture/objectInfos/Book__c.json';
import { ObjectInfoRepresentation } from '../../src/types';

suite('Diagnostics Test Suite - Server - GraphQL Validator', () => {
let sandbox: sinon.SinonSandbox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import { TextDocument } from 'vscode-languageserver-textdocument';
import { suite, test } from 'mocha';
import { HTMLValidator } from '../../validator/htmlValidator';
import { HTMLValidator } from '../../src/validator/htmlValidator';
import * as assert from 'assert';
import {
MobileOfflineFriendly,
RULE_ID
} from '../../diagnostic/html/mobileOfflineFriendly';
} from '../../src/diagnostic/html/mobileOfflineFriendly';

suite('Diagnostics Test Suite - Server - HTML Validator', () => {
const htmlValidator: HTMLValidator = new HTMLValidator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { TextDocument } from 'vscode-languageserver-textdocument';
import * as assert from 'assert';
import { suite, test } from 'mocha';

import { JSValidator } from '../../validator/jsValidator';
import { JSValidator } from '../../src/validator/jsValidator';
import {
AdaptersLocalChangeNotAware,
MESSAGE_FOR_GET_RELATED_LIST_RECORDS,
RULE_ID
} from '../../diagnostic/js/adapters-local-change-not-aware';
} from '../../src/diagnostic/js/adapters-local-change-not-aware';

suite('Diagnostics Test Suite - Server - JS Validator', () => {
const jsValidator = new JSValidator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { TextDocument } from 'vscode-languageserver-textdocument';
import * as assert from 'assert';
import { suite, test } from 'mocha';

import { ValidatorManager } from '../validatorManager';
import { MESSAGE_FOR_GET_RELATED_LIST_RECORDS } from '../diagnostic/js/adapters-local-change-not-aware';
import { ValidatorManager } from '../src/validatorManager';
import { MESSAGE_FOR_GET_RELATED_LIST_RECORDS } from '../src/diagnostic/js/adapters-local-change-not-aware';

suite('Diagnostics Test Suite - Server - ValidatorManager', () => {
const validatorManager = ValidatorManager.createInstance();
Expand Down
5 changes: 2 additions & 3 deletions lsp/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
"sourceMap": true,
"strict": true,
"outDir": "out",
"rootDir": "src",
"rootDir": ".",
"composite": true
},

"include": ["src"],
"include": ["src", "test", "testFixture/**/*.json"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test fixture needs to be specified in include, otherwise can't be found.

"exclude": ["node_modules"]
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"extensionDependencies": [
"salesforce.salesforcedx-vscode-core"
],
"main": "out/extension.js",
"main": "out/src/extension.js",
"l10n": "./l10n",
"contributes": {
"menus": {
Expand Down Expand Up @@ -95,14 +95,15 @@
"scripts": {
"clean": "rimraf out ./lsp/server/out ./lsp/client/out",
"compile": "rimraf ./lsp/server/tsconfig.tsbuildinfo ./lsp/client/tsconfig.tsbuildinfo && tsc -b ./ && npm run copy-resources",
"copy-resources": "cp -r './lsp/server/resources' './lsp/server/out/'",
"copy-resources": "cp -r './lsp/server/resources' './lsp/server/out/src/'",
"watch": "tsc -watch -b ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"test-coverage": "node ./out/test/runTest.js --coverage",
"prettier:write": "prettier --write \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"lsp/server/src/**/*.{ts, js}\" \"lsp/client/src/**/*.{ts, js}\"",
"prettier:verify": "prettier --list-different \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"lsp/server/src/**/*.{ts, js}\" \"lsp/client/src/**/*.{ts, js}\"",
"prettier:verify": "prettier --list-different \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"lsp/server/src/**/*.{ts, js}\" \"lsp/client/src/**/*.{ts, js}\""
,
sfdctaka marked this conversation as resolved.
Show resolved Hide resolved
"bundle:extension": "esbuild ./src/extension.ts --bundle --outdir=out --format=cjs --target=es2020 --platform=node --external:vscode --external:@salesforce/core --external:@oclif/core --external:@salesforce/lwc-dev-mobile-core --minify --sourcemap",
"vscode:prepublish": "npm run clean && npm run bundle:extension"
},
Expand Down
4 changes: 2 additions & 2 deletions src/test/TestHelper.ts → test/TestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as path from 'path';
import * as process from 'process';
import * as sinon from 'sinon';
import { WorkspaceUtils } from '../utils/workspaceUtils';
import { WorkspaceUtils } from '../src/utils/workspaceUtils';
import { TempProjectDirManager } from 'mobile-lsp-server';
export { TempProjectDirManager };

Expand All @@ -34,4 +34,4 @@ export function setupTempWorkspaceDirectoryStub(
const getWorkspaceDirStub = sinon.stub(WorkspaceUtils, 'getWorkspaceDir');
getWorkspaceDirStub.returns(projectDirManager.projectDir);
return getWorkspaceDirStub;
}
}
2 changes: 1 addition & 1 deletion src/test/runTest.ts → test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
runTests
} from '@vscode/test-electron';
import { spawnSync } from 'child_process';
import { CORE_EXTENSION_ID } from '../utils/constants';
import { CORE_EXTENSION_ID } from '../src/utils/constants';

const VSCODE_TEST_VERSION = 'stable';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import * as path from 'path';
import * as fs from 'fs';
import { window } from 'vscode';
import { afterEach } from 'mocha';
import { ConfigureLintingToolsCommand } from '../../../../commands/lint/configureLintingToolsCommand';
import { WorkspaceUtils } from '../../../../utils/workspaceUtils';
import { ConfigureLintingToolsCommand } from '../../../../src/commands/lint/configureLintingToolsCommand';
import { WorkspaceUtils } from '../../../../src/utils/workspaceUtils';
import {
TempProjectDirManager,
setupTempWorkspaceDirectoryStub
Expand Down Expand Up @@ -147,7 +147,7 @@ suite('Configure Linting Tools Command Test Suite', () => {
devDependencies: {
lwc: '1.2.3',
// eslint-disable-next-line @typescript-eslint/naming-convention
'@salesforce/eslint-plugin-lwc-mobile': '^1.0.0',
"@salesforce/eslint-plugin-lwc-mobile":"^1.0.0",
// eslint-disable-next-line @typescript-eslint/naming-convention
'@salesforce/eslint-plugin-lwc-graph-analyzer': '^0.9.0',
eslint: '^8.47.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import * as assert from 'assert';
import * as sinon from 'sinon';
import { commands, window } from 'vscode';
import { afterEach } from 'mocha';
import { AuthorizeCommand } from '../../../../commands/wizard/authorizeCommand';
import { OrgUtils } from '../../../../utils/orgUtils';
import { AuthorizeCommand } from '../../../../src/commands/wizard/authorizeCommand';
import { OrgUtils } from '../../../../src/utils/orgUtils';

suite('Authorize Org Command Test Suite', () => {
afterEach(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
import { afterEach, beforeEach } from 'mocha';
import { BriefcaseCommand } from '../../../../commands/wizard/briefcaseCommand';
import { BriefcaseCommand } from '../../../../src/commands/wizard/briefcaseCommand';
import { Uri, l10n, window, Progress, CancellationToken } from 'vscode';
import { CommonUtils } from '@salesforce/lwc-dev-mobile-core/lib/common/CommonUtils';
import { InstructionsWebviewProvider } from '../../../../webviews/instructions';
import { InstructionsWebviewProvider } from '../../../../src/webviews/instructions';

suite('Briefcase Command Test Suite', () => {
beforeEach(function () {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ConfigureProjectCommand,
DefaultProjectConfigurationProcessor,
ProjectConfigurationProcessor
} from '../../../../commands/wizard/configureProjectCommand';
} from '../../../../src/commands/wizard/configureProjectCommand';
import {
TempProjectDirManager,
createPlatformAbsolutePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as assert from 'assert';
import * as sinon from 'sinon';
import { afterEach } from 'mocha';
import { Uri, commands, window, workspace } from 'vscode';
import { DeployToOrgCommand } from '../../../../commands/wizard/deployToOrgCommand';
import { DeployToOrgCommand } from '../../../../src/commands/wizard/deployToOrgCommand';

suite('Deploy To Org Command Test Suite', () => {
afterEach(function () {
Expand Down
Loading
Loading