Skip to content

Commit

Permalink
Dashed-args (#1034)
Browse files Browse the repository at this point in the history
* adding useDashedArgs setting

* upgrade jest-editor-support to 31.1.0

* address lint issue
  • Loading branch information
connectdotz committed Jun 14, 2023
1 parent c2958df commit 479f4b6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -180,6 +180,12 @@
"type": "object",
"default": null,
"scope": "resource"
},
"jest.useDashedArgs": {
"markdownDescription": "Use dashed args for jest command line.",
"type": "boolean",
"default": false,
"scope": "resource"
}
}
},
Expand Down Expand Up @@ -486,7 +492,7 @@
"dependencies": {
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-source-maps": "^4.0.1",
"jest-editor-support": "^31.0.1"
"jest-editor-support": "^31.1.0"
},
"devDependencies": {
"@types/istanbul-lib-coverage": "^2.0.4",
Expand Down
4 changes: 3 additions & 1 deletion src/JestExt/helper.ts
Expand Up @@ -66,7 +66,8 @@ export const createJestExtContext = (
options?.collectCoverage ?? settings.showCoverageOnLoad,
settings.debugMode,
settings.nodeEnv,
settings.shell.toSetting()
settings.shell.toSetting(),
settings.useDashedArgs
);
};
return {
Expand Down Expand Up @@ -121,6 +122,7 @@ export const getExtensionResourceSettings = (uri: vscode.Uri): PluginResourceSet
autoRun: new AutoRun(config.get<JestExtAutoRunSetting | null>('autoRun')),
autoRevealOutput: config.get<AutoRevealOutputType>('autoRevealOutput') ?? 'on-run',
parserPluginOptions: config.get<JESParserPluginOptions>('parserPluginOptions'),
useDashedArgs: config.get<boolean>('useDashedArgs') ?? false,
};
};

Expand Down
1 change: 1 addition & 0 deletions src/Settings/index.ts
Expand Up @@ -51,6 +51,7 @@ export interface PluginResourceSettings {
monitorLongRun?: MonitorLongRun;
autoRevealOutput: AutoRevealOutputType;
parserPluginOptions?: JESParserPluginOptions;
useDashedArgs?: boolean;
}

export interface PluginWindowSettings {
Expand Down
12 changes: 12 additions & 0 deletions tests/JestExt/helper.test.ts
Expand Up @@ -56,6 +56,17 @@ describe('createJestExtContext', () => {
expect(toFilePath).toHaveBeenCalledWith(rootPath);
expect(runnerWorkspace).toEqual(mockRunnerWorkspace);
});
it('will pass through useDashedArgs', () => {
const settings: any = { ...baseSettings, useDashedArgs: true };

jest.clearAllMocks();

const { createRunnerWorkspace } = createJestExtContext(workspaceFolder, settings, output);
createRunnerWorkspace();
const args = (ProjectWorkspace as jest.Mocked<any>).mock.calls[0];
const [useDashedArgs] = [args[9]];
expect(useDashedArgs).toBeTruthy();
});
describe('allow creating runnerWorkspace with custom options', () => {
it('outputFileSuffix and collectCoverage', () => {
const settings: any = { ...baseSettings, showCoverageOnLoad: false };
Expand Down Expand Up @@ -163,6 +174,7 @@ describe('getExtensionResourceSettings()', () => {
shell: mockShell,
autoRevealOutput: 'on-run',
parserPluginOptions: null,
useDashedArgs: false,
});
});

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -2344,10 +2344,10 @@ jest-each@^29.3.1:
jest-util "^29.3.1"
pretty-format "^29.3.1"

jest-editor-support@^31.0.1:
version "31.0.1"
resolved "https://registry.yarnpkg.com/jest-editor-support/-/jest-editor-support-31.0.1.tgz#029d2fb29c5a455b628a3ddc0f07bab810ab3bbd"
integrity sha512-pzY3MypHzZaNNmawFZoEc5N7X+GQvtiy4KuPcsYC3ROXdVoGh0qdladd4pRrbuaggrTAGPOMxAq3x+BDVvqErw==
jest-editor-support@^31.1.0:
version "31.1.0"
resolved "https://registry.yarnpkg.com/jest-editor-support/-/jest-editor-support-31.1.0.tgz#087a8954d465288f3c544c75feb223f4bc31cea5"
integrity sha512-CGDZh5gO4NRthr6ocmD13pkuSDqZ03Cq+f6UuvwELoNN7p7rkZrEwjPZ/ysMDWoEzRtlTFZ+7sYmfE4kuyhIhQ==
dependencies:
"@babel/parser" "^7.20.7"
"@babel/runtime" "^7.20.7"
Expand Down

0 comments on commit 479f4b6

Please sign in to comment.