Skip to content

Commit

Permalink
Merge pull request #186 from WoodWing/feature/swc-jest
Browse files Browse the repository at this point in the history
refactor: replace ts-jest with @swc/jest
  • Loading branch information
wwjhu authored Sep 18, 2023
2 parents 840b385 + ea360a1 commit 0e5d916
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 99 deletions.
7 changes: 1 addition & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
},
},
moduleFileExtensions: ['ts', 'js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': '@swc/jest',
},
testMatch: ['**/test/**/*.test.(ts|js)'],
testEnvironment: 'node',
Expand Down
8 changes: 3 additions & 5 deletions lib/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path';
import * as semver from 'semver';
import ajv, { Schema, ValidateFunction } from 'ajv';
import addFormats from 'ajv-formats';
import * as chalk from 'chalk';
import { redBright } from 'chalk';
import * as jsonMap from 'json-source-map';

import { componentsDefinitionSchema_v1_0_x } from './components-schema-v1_0_x';
Expand Down Expand Up @@ -105,7 +105,7 @@ export async function validateFolder(folderPath: string): Promise<boolean> {
readFile(path.resolve(folderPath, filePath), options);
const getFileSize = async (filePath: string) => getSize(path.resolve(folderPath, filePath));
return validate(files, getFileContent, getFileSize, (errorMessage) => {
console.log(chalk.redBright(errorMessage));
console.log(redBright(errorMessage));
});
}

Expand Down Expand Up @@ -239,9 +239,7 @@ async function getComponentsDefinition(
try {
return jsonMap.parse(componentsDefinitionContent);
} catch (e) {
errorReporter(
chalk.redBright(`Components definition file "${componentsDefinitionPath}" is not valid json: \n${e}`),
);
errorReporter(redBright(`Components definition file "${componentsDefinitionPath}" is not valid json: \n${e}`));
}
return { data: null, pointers: null };
}
Expand Down
Loading

0 comments on commit 0e5d916

Please sign in to comment.