From 864ffdd1bf03c778f825d4da1bd4a6904b76e7ca Mon Sep 17 00:00:00 2001 From: Ihor Chulinda Date: Mon, 29 Jan 2018 16:23:32 +0100 Subject: [PATCH 1/3] fix(plugin-ts): adding support for paths from tsconfig fix #33 --- packages/baset-plugin-ts/package.json | 3 ++- packages/baset-plugin-ts/src/index.ts | 2 ++ tests/accept.spec.base | 3 +++ tests/test.spec.base | 2 ++ tests/typescript-project/lib/someCoolClass.ts | 8 ++++++++ tests/typescript-project/pathImport.spec.base | 1 + tests/typescript-project/pathImport.spec.ts | 3 +++ tests/typescript-project/tsconfig.json | 9 +++------ 8 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 tests/typescript-project/lib/someCoolClass.ts create mode 100644 tests/typescript-project/pathImport.spec.base create mode 100644 tests/typescript-project/pathImport.spec.ts diff --git a/packages/baset-plugin-ts/package.json b/packages/baset-plugin-ts/package.json index 5b020f04..d7267333 100644 --- a/packages/baset-plugin-ts/package.json +++ b/packages/baset-plugin-ts/package.json @@ -34,6 +34,7 @@ "dependencies": { "find-up": "^2.1.0", "ts-node": "^4.1.0", - "typescript": "^2.6.2" + "typescript": "^2.6.2", + "tsconfig-paths": "^3.1.1" } } diff --git a/packages/baset-plugin-ts/src/index.ts b/packages/baset-plugin-ts/src/index.ts index 1f04120a..0abc79b7 100644 --- a/packages/baset-plugin-ts/src/index.ts +++ b/packages/baset-plugin-ts/src/index.ts @@ -1,6 +1,7 @@ import { sync } from 'find-up'; import * as path from 'path'; import { Options, register } from 'ts-node'; +import { register as registerPaths } from 'tsconfig-paths'; import { CompilerOptions } from 'typescript'; import { isPrimitive } from 'util'; @@ -23,6 +24,7 @@ export default class TypeScriptReader { : { compilerOptions: config.compilerOptions }; register(registerOptions); + registerPaths(registerOptions.compilerOptions); // TODO: investigate do we need https://www.npmjs.com/package/tsconfig-paths } diff --git a/tests/accept.spec.base b/tests/accept.spec.base index 8563168d..78b70068 100644 --- a/tests/accept.spec.base +++ b/tests/accept.spec.base @@ -29,6 +29,8 @@ "", "Temp baseline for index.spec.ts is written.", "Test for index.spec.ts is passed", + "Temp baseline for pathImport.spec.ts is written.", + "Test for pathImport.spec.ts is passed", "" ], "stderr": [] @@ -38,6 +40,7 @@ "", "", "Baseline index.spec.base is written.", + "Baseline pathImport.spec.base is written.", "" ], "stderr": [] diff --git a/tests/test.spec.base b/tests/test.spec.base index 2cbaeaee..e69bc28c 100644 --- a/tests/test.spec.base +++ b/tests/test.spec.base @@ -17,6 +17,8 @@ "", "Temp baseline for index.spec.ts is written.", "Test for index.spec.ts is passed", + "Temp baseline for pathImport.spec.ts is written.", + "Test for pathImport.spec.ts is passed", "" ], "stderr": [] diff --git a/tests/typescript-project/lib/someCoolClass.ts b/tests/typescript-project/lib/someCoolClass.ts new file mode 100644 index 00000000..a81df5b6 --- /dev/null +++ b/tests/typescript-project/lib/someCoolClass.ts @@ -0,0 +1,8 @@ +export class SomeCoolClass { + private a = 1000; + private b = 300; + + getSum() { + return this.a + this.b; + } +} diff --git a/tests/typescript-project/pathImport.spec.base b/tests/typescript-project/pathImport.spec.base new file mode 100644 index 00000000..71c16a80 --- /dev/null +++ b/tests/typescript-project/pathImport.spec.base @@ -0,0 +1 @@ +{ "sum": 1300 } \ No newline at end of file diff --git a/tests/typescript-project/pathImport.spec.ts b/tests/typescript-project/pathImport.spec.ts new file mode 100644 index 00000000..c0dfa38e --- /dev/null +++ b/tests/typescript-project/pathImport.spec.ts @@ -0,0 +1,3 @@ +import { SomeCoolClass } from 'someCoolClass'; + +export const sum = new SomeCoolClass().getSum(); diff --git a/tests/typescript-project/tsconfig.json b/tests/typescript-project/tsconfig.json index d81cdd52..2497c523 100644 --- a/tests/typescript-project/tsconfig.json +++ b/tests/typescript-project/tsconfig.json @@ -16,14 +16,11 @@ "paths": { "*": [ "node_modules/*", - "src/types/*" + "src/types/*", + "lib/*" ] }, "experimentalDecorators": true, "emitDecoratorMetadata": true - }, - "include": [ - "src/**/*", - "!src/**/*.spec.ts" - ] + } } From 3d75a3e66c59b6cfa63ac294f6a24cd18932e7bd Mon Sep 17 00:00:00 2001 From: Ihor Chulinda Date: Mon, 29 Jan 2018 16:41:48 +0100 Subject: [PATCH 2/3] fix(core): replace all line endings with LF and trim baseline fix #32 --- packages/baset-core/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/baset-core/src/index.ts b/packages/baset-core/src/index.ts index dbec0947..c609d693 100644 --- a/packages/baset-core/src/index.ts +++ b/packages/baset-core/src/index.ts @@ -32,11 +32,11 @@ export class Tester { private testSpec = async (name: string) => { const reader = this.readers.find(({ pattern }) => pattern.test(name)); if (!reader) throw new Error(`No reader defined for ${name}!`); - const output = await reader.read(name); + const output = (await reader.read(name)).replace(/\r?\n|\r/g, '\n').trim(); const ext = path.extname(name); const baselinePath = path.resolve(name.replace(new RegExp(`${ext}$`), '.base')); const baselineValue = await isExists(baselinePath) - ? await readFile(baselinePath, { encoding: 'utf-8' }) + ? (await readFile(baselinePath, { encoding: 'utf-8' })).replace(/\r?\n|\r/g, '\n').trim() : false; await writeFile(path.resolve(`${baselinePath}.tmp`), output); From fffdd45df82e10771f279b02dcf6044a91274eb6 Mon Sep 17 00:00:00 2001 From: "Igmat (Travis CI)" Date: Mon, 29 Jan 2018 15:56:41 +0000 Subject: [PATCH 3/3] v0.5.1 --- CHANGELOG.md | 12 ++++++++++++ lerna.json | 2 +- packages/baset-cli/CHANGELOG.md | 8 ++++++++ packages/baset-cli/package.json | 6 +++--- packages/baset-core/CHANGELOG.md | 11 +++++++++++ packages/baset-core/package.json | 4 ++-- packages/baset-plugin-export/CHANGELOG.md | 8 ++++++++ packages/baset-plugin-export/package.json | 4 ++-- packages/baset-plugin-ts/CHANGELOG.md | 11 +++++++++++ packages/baset-plugin-ts/package.json | 8 ++++---- packages/baset/CHANGELOG.md | 8 ++++++++ packages/baset/package.json | 6 +++--- tests/sample-project/CHANGELOG.md | 8 ++++++++ tests/sample-project/package.json | 6 +++--- tests/typescript-project/CHANGELOG.md | 11 +++++++++++ tests/typescript-project/package.json | 8 ++++---- 16 files changed, 99 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cc181f..33a268c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + +### Bug Fixes + +* **core:** replace all line endings with LF and trim baseline ([3d75a3e](https://github.com/Igmat/baset/commit/3d75a3e)), closes [#32](https://github.com/Igmat/baset/issues/32) +* **plugin-ts:** adding support for paths from tsconfig ([864ffdd](https://github.com/Igmat/baset/commit/864ffdd)), closes [#33](https://github.com/Igmat/baset/issues/33) + + + + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/lerna.json b/lerna.json index 197c558e..c2a8823d 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ "./packages/*", "./tests/*" ], - "version": "0.5.0", + "version": "0.5.1", "commands": { "publish": { "allowBranch": "master", diff --git a/packages/baset-cli/CHANGELOG.md b/packages/baset-cli/CHANGELOG.md index 2916fe03..7dd92c78 100644 --- a/packages/baset-cli/CHANGELOG.md +++ b/packages/baset-cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + + + +**Note:** Version bump only for package baset-cli + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/packages/baset-cli/package.json b/packages/baset-cli/package.json index 9a8d435f..fbadc5b3 100644 --- a/packages/baset-cli/package.json +++ b/packages/baset-cli/package.json @@ -1,6 +1,6 @@ { "name": "baset-cli", - "version": "0.5.0", + "version": "0.5.1", "description": "CLI for BaseT project.", "keywords": [ "baset-cli", @@ -28,13 +28,13 @@ "@types/glob": "^5.0.34", "@types/node": "^9.3.0", "@types/yargs": "^10.0.1", - "baset": "^0.5.0", + "baset": "^0.5.1", "doctoc": "^1.3.0", "tslint": "^5.9.1", "typescript": "^2.6.2" }, "dependencies": { - "baset-core": "^0.5.0", + "baset-core": "^0.5.1", "find-up": "^2.1.0", "glob": "^7.1.2", "glob-promise": "^3.3.0", diff --git a/packages/baset-core/CHANGELOG.md b/packages/baset-core/CHANGELOG.md index 205d8939..da05a515 100644 --- a/packages/baset-core/CHANGELOG.md +++ b/packages/baset-core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + +### Bug Fixes + +* **core:** replace all line endings with LF and trim baseline ([3d75a3e](https://github.com/Igmat/baset/commit/3d75a3e)), closes [#32](https://github.com/Igmat/baset/issues/32) + + + + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/packages/baset-core/package.json b/packages/baset-core/package.json index 588761ff..6f8b17a1 100644 --- a/packages/baset-core/package.json +++ b/packages/baset-core/package.json @@ -1,6 +1,6 @@ { "name": "baset-core", - "version": "0.5.0", + "version": "0.5.1", "description": "Core library for BaseT project.", "keywords": [ "baset-core", @@ -25,7 +25,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^9.3.0", - "baset": "^0.5.0", + "baset": "^0.5.1", "doctoc": "^1.3.0", "tslint": "^5.9.1", "typescript": "^2.6.2" diff --git a/packages/baset-plugin-export/CHANGELOG.md b/packages/baset-plugin-export/CHANGELOG.md index 79c7be76..71607a5c 100644 --- a/packages/baset-plugin-export/CHANGELOG.md +++ b/packages/baset-plugin-export/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + + + +**Note:** Version bump only for package baset-plugin-export + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/packages/baset-plugin-export/package.json b/packages/baset-plugin-export/package.json index c1b819b0..a7daa27b 100644 --- a/packages/baset-plugin-export/package.json +++ b/packages/baset-plugin-export/package.json @@ -1,6 +1,6 @@ { "name": "baset-plugin-export", - "version": "0.5.0", + "version": "0.5.1", "description": "Export plugin for BaseT project.", "keywords": [ "baset-plugin-export", @@ -25,7 +25,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^9.3.0", - "baset": "^0.5.0", + "baset": "^0.5.1", "doctoc": "^1.3.0", "tslint": "^5.9.1", "typescript": "^2.6.2" diff --git a/packages/baset-plugin-ts/CHANGELOG.md b/packages/baset-plugin-ts/CHANGELOG.md index fbaaf986..6261af52 100644 --- a/packages/baset-plugin-ts/CHANGELOG.md +++ b/packages/baset-plugin-ts/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + +### Bug Fixes + +* **plugin-ts:** adding support for paths from tsconfig ([864ffdd](https://github.com/Igmat/baset/commit/864ffdd)), closes [#33](https://github.com/Igmat/baset/issues/33) + + + + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/packages/baset-plugin-ts/package.json b/packages/baset-plugin-ts/package.json index d7267333..f9cf02cc 100644 --- a/packages/baset-plugin-ts/package.json +++ b/packages/baset-plugin-ts/package.json @@ -1,6 +1,6 @@ { "name": "baset-plugin-ts", - "version": "0.5.0", + "version": "0.5.1", "description": "TypeScript plugin for BaseT project.", "keywords": [ "baset-plugin-ts", @@ -26,7 +26,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^9.3.0", - "baset": "^0.5.0", + "baset": "^0.5.1", "doctoc": "^1.3.0", "tslint": "^5.9.1", "typescript": "^2.6.2" @@ -34,7 +34,7 @@ "dependencies": { "find-up": "^2.1.0", "ts-node": "^4.1.0", - "typescript": "^2.6.2", - "tsconfig-paths": "^3.1.1" + "tsconfig-paths": "^3.1.1", + "typescript": "^2.6.2" } } diff --git a/packages/baset/CHANGELOG.md b/packages/baset/CHANGELOG.md index 9012bdc7..263b1f72 100644 --- a/packages/baset/CHANGELOG.md +++ b/packages/baset/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + + + +**Note:** Version bump only for package baset + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/packages/baset/package.json b/packages/baset/package.json index 5ab447bd..0ec1b033 100644 --- a/packages/baset/package.json +++ b/packages/baset/package.json @@ -1,6 +1,6 @@ { "name": "baset", - "version": "0.5.0", + "version": "0.5.1", "description": "Tool for testing using baseline strategy.", "keywords": [ "baset", @@ -24,8 +24,8 @@ "prepublish": "node ./scripts/prepublish.js" }, "dependencies": { - "baset-cli": "^0.5.0", - "baset-plugin-export": "^0.5.0" + "baset-cli": "^0.5.1", + "baset-plugin-export": "^0.5.1" }, "devDependencies": { "@types/node": "^9.3.0" diff --git a/tests/sample-project/CHANGELOG.md b/tests/sample-project/CHANGELOG.md index 2f669f4b..2617c26b 100644 --- a/tests/sample-project/CHANGELOG.md +++ b/tests/sample-project/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + + + +**Note:** Version bump only for package sample-project + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/tests/sample-project/package.json b/tests/sample-project/package.json index 1b8184a7..d261f8e1 100644 --- a/tests/sample-project/package.json +++ b/tests/sample-project/package.json @@ -1,6 +1,6 @@ { "name": "sample-project", - "version": "0.5.0", + "version": "0.5.1", "private": true, "description": "", "main": "index.js", @@ -11,7 +11,7 @@ "author": "", "license": "MIT", "devDependencies": { - "baset": "^0.5.0", - "baset-plugin-export": "^0.5.0" + "baset": "^0.5.1", + "baset-plugin-export": "^0.5.1" } } diff --git a/tests/typescript-project/CHANGELOG.md b/tests/typescript-project/CHANGELOG.md index 828dd527..6c5f64ff 100644 --- a/tests/typescript-project/CHANGELOG.md +++ b/tests/typescript-project/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.1](https://github.com/Igmat/baset/compare/v0.5.0...v0.5.1) (2018-01-29) + + +### Bug Fixes + +* **plugin-ts:** adding support for paths from tsconfig ([864ffdd](https://github.com/Igmat/baset/commit/864ffdd)), closes [#33](https://github.com/Igmat/baset/issues/33) + + + + # [0.5.0](https://github.com/Igmat/baset/compare/v0.4.1...v0.5.0) (2018-01-26) diff --git a/tests/typescript-project/package.json b/tests/typescript-project/package.json index b40d61b9..8be85e1e 100644 --- a/tests/typescript-project/package.json +++ b/tests/typescript-project/package.json @@ -1,6 +1,6 @@ { "name": "typescript-project", - "version": "0.5.0", + "version": "0.5.1", "private": true, "description": "", "main": "index.js", @@ -11,9 +11,9 @@ "author": "", "license": "MIT", "devDependencies": { - "baset": "^0.5.0", - "baset-plugin-export": "^0.5.0", - "baset-plugin-ts": "^0.5.0", + "baset": "^0.5.1", + "baset-plugin-export": "^0.5.1", + "baset-plugin-ts": "^0.5.1", "typescript": "^2.6.2" } }