Closed cramhead closed 7 years ago
There is no way currently to blacklist files, but it may be possible using packages configuration. However it sounds to me like the problem is that files are not getting transpiled from es6 modules to common's. That is what the error is saying - there are still import statements in the code which node is trying to run.
@cramhead if the source files are .tsx
they need to be transpiled even if they don't contain import export because they will likely contain TypeScript specific syntax as well as jsx syntax. Unless you have conflicting compiler options for your own source or for other dependencies, you should be able to accomplish this by configuring the loader to pass those files through plugin-typescript. As @frankwallis noted you can accomplish this with package configuration.
This is just an example:
SystemJS.config({
transpiler: "plugin-typescript",
packages: {
"jest/tests": {
"*.tsx": {
loader: "plugin-typescript"
}
}
}
});
react-redux-typescript-starter-kit uses the ts-jest plugin to compile typescript when running jest. This is all configured in jest.config.json
- to run the tests use jest --config ./jest.config.json
or npm test
and the files should get compiled.
see https://github.com/piotrwitek/react-redux-typescript-starter-kit/blob/master/package.json#L30
I'm using, https://github.com/piotrwitek/react-redux-typescript-starter-kit, which in turn is using the plugin-typescript. Thank for making this. I trying integrate jest, https://github.com/facebook/jest, and I keep running into an issue
SyntaxError: Unexpected token import
. My hypothesis is that the plugin is transpiling tests, they have a tsx extension. Is there a mechanism to blacklist certain folders, e.g. test or something like that?