Skip to content

Commit

Permalink
Merge pull request #720 from connectdotz/runner-cwd-path
Browse files Browse the repository at this point in the history
convert ProjectWorkspace rootPath to upper-case drive-letter in windows
  • Loading branch information
stephtr committed May 27, 2021
2 parents ff69ddb + 9d7ba45 commit cb9f0a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ Bug-fixes within the same version aren't needed
* add `--watchAll=false` to non-watch tasks - @connectdotz
* move save related operations to new SaveTextDocument event listeners to prevent duplicate firing and losing test state for watch-mode + clean-doc-save combination. - @connectdotz
* move testFile state to ResultProvider that provides a union of test-files and actual results, to be more robust even when there is a race condition when fileList comes after test run. - @connectdotz
* convert to upper-case drive letter for ProjectWorkspace rootPath - @connectdotz
-->

### 4.0.2
Expand Down
4 changes: 2 additions & 2 deletions src/JestExt/helper.ts
Expand Up @@ -7,7 +7,7 @@ import { ProjectWorkspace } from 'jest-editor-support';
import { JestProcessRequest } from '../JestProcessManagement';
import { PluginResourceSettings, JestExtAutoRunConfig } from '../Settings';
import { AutoRunMode } from '../StatusBar';
import { pathToJest, pathToConfig } from '../helpers';
import { pathToJest, pathToConfig, toFilePath } from '../helpers';
import { workspaceLogging } from '../logging';
import { AutoRunAccessor, JestExtContext } from './types';
import { CoverageColors } from '../Coverage';
Expand Down Expand Up @@ -81,7 +81,7 @@ export const createJestExtContext = (
const currentJestVersion = 20;
const [jestCommandLine, pathToConfig] = getJestCommandSettings(settings);
const runnerWorkspace = new ProjectWorkspace(
settings.rootPath,
toFilePath(settings.rootPath),
jestCommandLine,
pathToConfig,
currentJestVersion,
Expand Down
10 changes: 7 additions & 3 deletions tests/JestExt/helper.test.ts
Expand Up @@ -11,6 +11,7 @@ import { ProjectWorkspace } from 'jest-editor-support';
import { workspaceLogging } from '../../src/logging';
import { pathToJest, pathToConfig } from '../../src/helpers';
import { mockProjectWorkspace } from '../test-helper';
import { toFilePath } from '../../src/helpers';

describe('createJestExtContext', () => {
const workspaceFolder: any = { name: 'workspace' };
Expand Down Expand Up @@ -84,11 +85,14 @@ describe('createJestExtContext', () => {
});
});
it('will create runnerWorkspace', () => {
const settings: any = {};
(ProjectWorkspace as jest.Mocked<any>).mockReturnValue({});
const rootPath = 'abc';
const settings: any = { rootPath };
const mockRunnerWorkspace = { rootPath };
(ProjectWorkspace as jest.Mocked<any>).mockReturnValue(mockRunnerWorkspace);
const context = createJestExtContext(workspaceFolder, settings);
expect(ProjectWorkspace).toBeCalled();
expect(context.runnerWorkspace).toEqual({});
expect(toFilePath).toBeCalledWith(rootPath);
expect(context.runnerWorkspace).toEqual(mockRunnerWorkspace);
});
it('will create logging factory', () => {
const settings: any = {};
Expand Down

0 comments on commit cb9f0a5

Please sign in to comment.