diff --git a/.npmignore b/.npmignore index df200e04..5edfbd7b 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ /docs/ +/test/ /sample/ /recipes/ .gitignore diff --git a/package.json b/package.json index 32a3f1bb..08c2af46 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ }, "jest": { "roots": [ + "test", "src", "bin", "parser", diff --git a/parser/__tests__/__snapshots__/tsx-test.js.snap b/parser/__tests__/__snapshots__/tsx-test.js.snap index 1811f477..1fd8f03a 100644 --- a/parser/__tests__/__snapshots__/tsx-test.js.snap +++ b/parser/__tests__/__snapshots__/tsx-test.js.snap @@ -9,6 +9,7 @@ exports[`tsxParser parse extends the ts config with jsx support 1`] = ` "plugins": [ "jsx", "asyncGenerators", + "decoratorAutoAccessors", "bigInt", "classPrivateMethods", "classPrivateProperties", diff --git a/parser/tsOptions.js b/parser/tsOptions.js index 05e249a9..040d185a 100644 --- a/parser/tsOptions.js +++ b/parser/tsOptions.js @@ -19,6 +19,7 @@ module.exports = { tokens: true, plugins: [ 'asyncGenerators', + 'decoratorAutoAccessors', 'bigInt', 'classPrivateMethods', 'classPrivateProperties', diff --git a/src/__tests__/ts-decorator-auto-accessor-test.js b/src/__tests__/ts-decorator-auto-accessor-test.js new file mode 100644 index 00000000..3e18275e --- /dev/null +++ b/src/__tests__/ts-decorator-auto-accessor-test.js @@ -0,0 +1,26 @@ +'use strict'; + +function transformer(file, api) { + const j = api.jscodeshift; + + return j(file.source).toSource(); +} + +transformer.parser = 'ts'; + +jest.autoMockOff(); +const defineInlineTest = require('../../src/testUtils').defineInlineTest; + +describe('should be parse typescript decoratorAutoAccessors correctly', function () { + defineInlineTest( + transformer, + {}, + 'export class Test {\n' + + ' public accessor myValue = 10;\n' + + '}\n', + 'export class Test {\n' + + ' public accessor myValue = 10;\n' + + '}', + 'ts-decorator-auto-accessor', + ); +});