Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@simplrjs/test-generator-cli
Advanced tools
Tool to generate tests from cases.
npm install @simplrjs/test-generator-cli -g
Global installation is not necessary. You can install this package with:
npm install @simplrjs/test-generator-cli --save-dev
and use it with npm-scripts
.
test-generator-cli -h
Argument | Type | Default | Description |
---|---|---|---|
-h, --help | boolean | false | Show help. |
-v, --version | boolean | false | Show current version. |
-p, --project | string | ./ | Project directory path. |
Let's say you picked src
as your project directory.
├── src
└── tests
├── cases
│ ├── __tests__
│ | └── __snapshots__
│ ├── case-1
│ │ ├── ...
│ │ ├── test-config.json
│ │ └── case.test.tpl
│ └── case-2
└── default.test.tpl
File / Directory | Description |
---|---|
__tests__ | Generated tests output directory. |
__snapshots__ | Generated tests snapshots directory. |
case-1 , case-2 | Directories for test cases. |
case.test.tpl | Test template file for certain test case. It's not required. If case.test.tpl not found in case directory, test template will fallback to default.test.tpl . |
test-config.json | Config file for a test case. You can reach it template. Config structure is at your discretion. |
default.test.tpl | Default test template file. |
Package supports two kinds of templates:
case.test.tpl
- test template file for certain test case. It's not required. If case.test.tpl
not found in case directory, test template will fallback to default.test.tpl
.default.test.tpl
- default test template file.Template should be a valid TypeScript file that can have Handlebars expressions.
Expression | Description |
---|---|
{{caseName}} | Test case name. |
{{projectDirectory}} | Project directory path. |
{{json testConfig}} | Test case config file (test-config.json ) content. |
import * as path from "path";
import { Bundler } from "@src/bundler";
test("{{caseName}}", async done => {
const projectDirectory = "{{projectDirectory}}";
const testConfig = {{{json testConfig}}};
const entryFile = path.join(projectDirectory, testConfig.Entry);
try {
const bundleResult = await new Bundler()
.BundleAll([entryFile]);
expect(bundleResult[0].bundledContent).toMatchSnapshot();
done();
} catch (error) {
done.fail(error);
}
});
Released under the MIT license.
FAQs
Tool to generate tests from cases.
The npm package @simplrjs/test-generator-cli receives a total of 9 weekly downloads. As such, @simplrjs/test-generator-cli popularity was classified as not popular.
We found that @simplrjs/test-generator-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.