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

Bump ws from 5.2.2 to 5.2.3 #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
npm-debug.log*

# Runtime data
pids
Expand Down
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ vsc-extension-quickstart.md
**/tsconfig.json
**/tslint.json
**/*.map
**/*.ts
node_modules
**/*.ts
out/
src/
tsconfig.json
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Piotr Porzuczek
Copyright (c) 2022 Piotr Porzuczek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Jest-cucumber code generator for VS Code.

This plugin allows you to generate tests that match those generated by
[Jest-cucumber](https://github.com/bencompton/jest-cucumber)
The plug-in, which allows you to generate unit tests in Gherkin format, is an innovative way to approach unit tests. The technique is typically used for end-to-end testing, but by implementing it in unit tests, developers can get a more structured approach to their tests, which can speed up overall software development. Another benefit of using Gherkin for unit testing is that it can help ensure that all necessary test cases are included in tests. This is because a natural language, as opposed to a programming language, encourages a declarative writing style that helps make sure that all relevant details are included in each test case. This can save when a programmer is trying to track down why a particular test failed. Overall, using the Gherkin unit test generation plugin is an innovative way to improve the efficiency and effectiveness of unit tests.
Plugin allows you to generate unit tests in Gherkin format, is an innovative way to approach unit tests. The technique is typically used for end-to-end testing, but by implementing it in unit tests, developers can get a more structured approach to their tests, which can speed up overall software development. Another benefit of using Gherkin for unit testing is that it can help ensure that all necessary test cases are included in tests. This is because a natural language, as opposed to a programming language, encourages a declarative writing style that helps make sure that all relevant details are included in each test case. This can save when a programmer is trying to track down why a particular test failed. Overall, using the Gherkin unit test generation plugin is an innovative way to improve the efficiency and effectiveness of unit tests.

[Install from marketplace](https://marketplace.visualstudio.com/items?itemName=Piotr-Porzuczek.jest-cucumber-code-generator-extension)

Expand Down
2 changes: 1 addition & 1 deletion config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const config = {
entry: path.resolve(__dirname, '../../', './src/extension.ts'),
output: {
path: path.resolve(__dirname, '../../', 'dist'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
filename: 'extension.js',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
devtool: 'source-map',
Expand Down
47 changes: 33 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"activationEvents": [
"onCommand:extension.generateCodeFromFeature"
],
"icon": "icon.png",
"main": "./dist/extension",
"icon": "icon.png",
"contributes": {
"commands": [
{
Expand Down
20 changes: 10 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ function processDocument() {
selectionInformation: createSelectionLinesInformation(editor)
};
}
function createSelectionLinesInformation(editor) {
return {
count: editor.document.lineCount,
start: editor.selection.start.line + 1,
end: editor.selection.end.line + 1,
text: editor.document.getText(
editor.selection
)
};
}
function putCommandsInClipboard(
documentText,
selectionInformation
Expand All @@ -53,14 +63,4 @@ function putCommandsInClipboard(
}
function handleError(error) {
vscode.window.showErrorMessage(error.message);
}
function createSelectionLinesInformation(editor) {
return {
count: editor.document.lineCount,
start: editor.selection.start.line + 1,
end: editor.selection.end.line + 1,
text: editor.document.getText(
editor.selection
)
};
}
34 changes: 17 additions & 17 deletions src/modules/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import {
js }
from 'js-beautify';

function format(commands, wrap) {
const newLine = '\r\n';
let commandsAsText = commands.join(newLine);
if (wrap) {
commandsAsText = wrapInDefineFeature(
commandsAsText).join(newLine);
function formatJavascript(commands) {
const formatedJavascript = js(
commands,
{
indent_size: 2,
space_in_empty_parent: true
}

return formatJavascript(commandsAsText);
);

return formatedJavascript;
}
function wrapInDefineFeature(commandsAsText) {
const commandsInDefineFeature = [
Expand All @@ -21,16 +22,15 @@ function wrapInDefineFeature(commandsAsText) {

return commandsInDefineFeature;
}
function formatJavascript(commands) {
const formatedJavascript = js(
commands,
{
indent_size: 2,
space_in_empty_parent: true
function format(commands, wrap) {
const newLine = '\r\n';
let commandsAsText = commands.join(newLine);
if (wrap) {
commandsAsText = wrapInDefineFeature(
commandsAsText).join(newLine);
}
);

return formatedJavascript;

return formatJavascript(commandsAsText);
}

export default {
Expand Down
40 changes: 20 additions & 20 deletions src/modules/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ function generateCommandsFromFeatureAsText(
);
}
}
function areScenariosPresentIn(feature) {
return feature.scenarios.length +
feature.scenarioOutlines.length > 0;
}
function generateCommands(
feature,
selectionInformation
Expand All @@ -44,16 +40,20 @@ function generateCommands(
);
}
}
function isFeatureIn(selectionInformation) {
return selectionInformation.start === 1;
function areScenariosPresentIn(feature) {
return feature.scenarios.length +
feature.scenarioOutlines.length > 0;
}
function isStepIn(selectionInformation) {
return !selectionInformation.text
.toLowerCase().includes('scenario:');
}
function isScenarioIn(selectionInformation) {
return selectionInformation.text
.toLowerCase().includes('scenario:');
}
function isStepIn(selectionInformation) {
return !selectionInformation.text
.toLowerCase().includes('scenario:');
function isFeatureIn(selectionInformation) {
return selectionInformation.start === 1;
}
function generateFeatureCommands(
feature
Expand Down Expand Up @@ -98,17 +98,6 @@ function filterScenariosFrom(
lineNumber <= end;
});
}
function generateCommandsFrom(feature) {
return feature.scenarios
.concat(feature.scenarioOutlines)
.sort((a, b) =>
Math.sign(a.lineNumber - b.lineNumber))
.map(scenario =>
generateCodeFromFeature(
feature,
scenario.lineNumber
));
}
function generateStepsCommands(
feature,
selectionInformation
Expand All @@ -128,6 +117,17 @@ function generateStepsCommands(
false
);
}
function generateCommandsFrom(feature) {
return feature.scenarios
.concat(feature.scenarioOutlines)
.sort((a, b) =>
Math.sign(a.lineNumber - b.lineNumber))
.map(scenario =>
generateCodeFromFeature(
feature,
scenario.lineNumber
));
}

export default {
generateCommandsFromFeatureAsText
Expand Down
6 changes: 3 additions & 3 deletions src/utilities/typings/process.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
declare namespace NodeJS {
export interface Process {
export interface Global {
vscode?: any
}
export interface ProcessEnv {
export interface Process {
vscode?: any
}
export interface Global {
export interface ProcessEnv {
vscode?: any
}
}
Loading