Skip to content

Commit

Permalink
add plugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m1d0v committed Jul 11, 2024
1 parent 669b4b1 commit 15f27ad
Show file tree
Hide file tree
Showing 9 changed files with 7,446 additions and 2,064 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
/coverage
/node_modules
/tests
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
transformIgnorePatterns: [],
transform: {
'^.+\\.(j|t)s?$': [
'ts-jest',
{
isolatedModules: true,
tsconfig: '<rootDir>/tests/tsconfig.json',
},
],
},
};
8,739 changes: 6,679 additions & 2,060 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@
"build:declarations": "tsc --emitDeclarationOnly --outDir ./build",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"test": "exit 0"
"test": "jest"
},
"devDependencies": {
"@diplodoc/eslint-config": "^2.0.0",
"@diplodoc/prettier-config": "^2.0.0",
"@diplodoc/transform": "^4.20.0",
"@diplodoc/tsconfig": "^1.0.2",
"@types/jest": "^29.5.12",
"@types/markdown-it": "^13.0.8",
"esbuild": "^0.20.2",
"esbuild-sass-plugin": "^3.3.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"npm-run-all": "^4.1.5",
"ts-jest": "^29.2.2",
"typescript": "^5.3.3"
}
}
2 changes: 2 additions & 0 deletions src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export type {TransformOptions} from './transform';
export {transform} from './transform';
export {TokenType} from './const';
6 changes: 3 additions & 3 deletions src/plugin/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const registerTransform = (
});
};

type NormalizedPluginOptions = Omit<PluginOptions, 'runtime'> & {
type NormalizedPluginOptions = Omit<TransformOptions, 'runtime'> & {
runtime: Runtime;
};

export type PluginOptions = {
export type TransformOptions = {
runtime?:
| string
| {
Expand All @@ -51,7 +51,7 @@ type InputOptions = {
destRoot: string;
};

export function transform(options: Partial<PluginOptions> = {}) {
export function transform(options: Partial<TransformOptions> = {}) {
const {bundle = true} = options;

if (bundle && typeof options.runtime === 'string') {
Expand Down
Loading

0 comments on commit 15f27ad

Please sign in to comment.