Skip to content

Commit

Permalink
Change working directory for test.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdctaka committed Nov 19, 2024
1 parent 281fc8d commit 5112f03
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
18 changes: 18 additions & 0 deletions test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ async function main() {
throw new Error(installNonZeroError);
}

// Windows runs test runner process from .vscode-test\vscode-win32-x64-archive-1.95.3 folder.
// Set the process to run from the project's root.
if (isWindows) {
process.chdir('..\..');

console.log('ttt----------------------');
console.error('ttt----------------------');
const cwd = process.cwd();
console.log(cwd);
console.error(cwd);
}

console.log('qqq----------------------');
console.error('qqq----------------------');
const cwd = process.cwd();
console.log(cwd);
console.error(cwd);

// All clear! Should be able to run the tests.
await runTests({
extensionDevelopmentPath,
Expand Down
21 changes: 20 additions & 1 deletion test/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,26 @@ export async function run(): Promise<void> {
color: true
});

const testsRoot = path.resolve(__dirname, '..');
//const testsRoot = path.resolve(__dirname, '..');
let testsRoot = path.resolve(__dirname, '..');
console.log('zzz----------------------');
console.error('zzz----------------------');
const cwd = process.cwd();
console.log(cwd);
console.error(cwd);
console.log(__dirname);
console.error(__dirname);

const isWindows = process.platform === 'win32';
if (isWindows) {
process.chdir('..\..\..\..');

console.log('xxx----------------------');
console.error('xxx----------------------');
const cwd = process.cwd();
console.log(cwd);
console.error(cwd);
}

return new Promise((c, e) => {
const testDirs = [testsRoot];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ suite(
let oversizedRecordProducer = new OversizedRecord();

const cwd = process.cwd();
console.log(require.main?.path);
console.error(require.main?.path);
console.log('----------------------');
console.error('----------------------');
console.log(cwd);
console.error(cwd);
console.log('----------------------');
console.error('----------------------');
const testFixturePath = path.resolve(cwd, 'test/suite/lsp/server/testFixture/objectInfos/Book__c.json');
console.log('----------------------');
console.error('----------------------');
console.log(testFixturePath);
console.error(testFixturePath);
console.log('----------------------');
console.error('----------------------');
const book = JSON.parse(readFileSync(testFixturePath, 'utf-8'));

beforeEach(function () {
Expand Down

0 comments on commit 5112f03

Please sign in to comment.