Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@code-to-json/test-helpers
Advanced tools
This package contains a variety of test helpers, useful for testing tools built on top of the TypeScript compiler API in general, and code-to-json in particular
createTempFixtureFolder
Create collection of files and folders in your OS system temp folder
You may either refer to an existing folder on disk
import { createTempFixtureFolder } from '@code-to-json/test-helpers';
// Create the test case in your system temp folder
const { rootPath, cleanup } = await createTempFixtureFolder('path/to/my/fixture/on/disk');
cleanup(); // Completely delete the test case from disk
or describe your fixture using a plain JS/TS object
import { createTempFixtureFolder } from '@code-to-json/test-helpers';
// Create the test case in your system temp folder
const { rootPath, cleanup } = await createTempFixtureFolder({
// ./tsconfig.json
'tsconfig.json': `
{
"compilerOptions": {
"noEmit": true,
"module": "es6",
"target": "es2015"
},
"include": ["src"]
}
`,
src: {
// ./src/index.ts
'index.ts': `
/**
* This is a variable with an explicit type
*/
const constWithExplicitType: string = 'foo';
`,
},
});
cleanup(); // Completely delete the test case from disk
setupTestCase
Create the same folder structure described above for createTempFixtureFolder
, and also initialize it as a TypeScript program.
import * as ts from 'typescript';
import { setupTestCase } from '@code-to-json/test-helpers';
// Create the test case in your system temp folder
const program: ts.Program = await setupTestCase(
/**
* Root folder of the fixture on disk
* (you can also provide a "fixture object" as described above)
*/
'path/to/my/fixture/on/disk',
/**
* One or more entry points of your application. Any imports will be included
* in the TS program as well
*/
['src/index.ts'],
);
This library has a very strong commitment to semantic versioning, and makes use of conventional commits to automatically generate changelogs, and to increment version numbers appropriately when publishing.
© 2018 LinkedIn
FAQs
Test helpers for code-to-json
We found that @code-to-json/test-helpers 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.