How to use the ts-jest/preprocessor.js.process function in ts-jest

To help you get started, we’ve selected a few ts-jest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pluto-net / scinapse-web-client / jest / jestPreprocessor.js View on Github external
path.endsWith(".scss") ||
      path.endsWith(".css") ||
      path.endsWith(".sass")
    ) {
      return "module.exports = new Proxy({}, { get: function (target, name) { return name; } });";
    }

    if (path.endsWith(".svg")) {
      const pathArr = path.split("/");
      const iconFileName = encodeURIComponent(
        pathArr[pathArr.length - 1].replace(".svg", "")
      );
      return `module.exports = new Proxy({}, { get: function () { return "${iconFileName.trim()}"; } });`;
    }

    const typeParsedResult = tsPreProcessor.process(src, path, config);

    return typeParsedResult;
  }
};
github salesforce / lwc / packages / locker-membrane / scripts / jest / compat-preprocessor.js View on Github external
process(src, path, options, transpileOptions) {
        if (path.endsWith('.js') || path.endsWith('.ts')) {
            const code = tsJest.process(src, path, options, transpileOptions);
            return transpile(code, path);
        }
        return src;
    }
};
github salesforce / lwc / packages / raptor-engine / scripts / jest / compat-preprocessor.js View on Github external
process(src, path, config, transpileConfig) {
        if (path.endsWith('.js') || path.endsWith('.ts')) {
            const tsc = tsJest.process(src, path, config, transpileConfig);
            return transpile(tsc, path);
        }
        return src;
    }
};