├── .bettercodehub.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Is_TDD_wrong.RU.md ├── Is_TDD_wrong.md └── images │ ├── angular-docs-screenshot.png │ ├── become_a_patron_button.png │ ├── logo.svg │ ├── react-docs-screenshot.png │ ├── sprite-export-sample.png │ ├── tdd-cycle-for-changes-right.svg │ ├── tdd-cycle-for-changes-wrong.svg │ ├── tdd-cycle.svg │ ├── test-as-doc-example.png │ ├── timeline-for-frameworks-and-libraries.svg │ ├── timeline-for-test-tools.svg │ └── timeline-for-tooling.svg ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── baset-baseliner-json │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── beautifier.ts │ │ └── index.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-baseliner-md │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── types │ │ │ ├── clean-html.d.ts │ │ │ ├── remark-parse.d.ts │ │ │ └── unified.d.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-cli │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── TAP.ts │ │ ├── commands │ │ │ ├── accept.ts │ │ │ ├── scaffold.ts │ │ │ └── test.ts │ │ ├── index.ts │ │ ├── options │ │ │ └── index.ts │ │ └── types │ │ │ ├── glob-promise.d.ts │ │ │ └── tap-diff.d.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── abstractBaseliner.ts │ │ ├── abstractEnvironment.ts │ │ ├── abstractReader.ts │ │ ├── abstractResolver.ts │ │ ├── dataTypes.ts │ │ ├── index.ts │ │ ├── scaffolder.ts │ │ ├── tap.ts │ │ ├── testError.ts │ │ ├── testGroup.ts │ │ ├── tester.ts │ │ └── utils.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-env-browser │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── runInContext.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-reader-babel │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── types │ │ │ └── babel-core-extension.d.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-reader-md │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── types │ │ │ └── markdown.d.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-reader-ts │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-resolver-pixi │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── matchInContext.ts │ │ └── renderInContext.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-resolver-react │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ └── tslint.json ├── baset-vm │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── VMError.ts │ │ ├── VMScript.ts │ │ ├── index.ts │ │ └── sandbox.ts │ ├── tsconfig.json │ └── tslint.json └── baset │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── bin │ └── index.js │ ├── package-lock.json │ ├── package.json │ └── scripts │ └── prepublish.js ├── scripts └── createBinSymlinks.js ├── tests ├── accept.spec.base ├── accept.spec.ts ├── babel-project │ ├── .babelrc │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.jsx │ ├── index.spec.base.md │ ├── index.spec.jsx │ ├── package-lock.json │ └── package.json ├── canvas-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── assets │ │ ├── abstract-baset.jpg │ │ ├── assets.json │ │ └── assets.png │ ├── graphics.spec.base.md │ ├── graphics.spec.ts │ ├── graphics.ts │ ├── package-lock.json │ ├── package.json │ ├── sprite.spec.base.md │ ├── sprite.spec.ts │ ├── sprite.ts │ └── tsconfig.json ├── circular-reference-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base │ ├── index.spec.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── dom-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.js │ ├── index.spec.base │ ├── index.spec.js │ └── package.json ├── md-specs-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base.md │ ├── index.spec.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── sample-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.js │ ├── index.spec.base │ ├── index.spec.js │ ├── package-lock.json │ └── package.json ├── scaffold.spec.base ├── scaffold.spec.ts ├── scaffolded-project │ ├── .basetrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── someClass.ts │ └── tsconfig.json ├── test.spec.base ├── test.spec.ts ├── tsx-babel-project │ ├── .babelrc │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base.md │ ├── index.spec.tsx │ ├── index.tsx │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── tsx-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base.md │ ├── index.spec.tsx │ ├── index.tsx │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── tsx-styled-components-project │ ├── .basetrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── images.d.ts │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ ├── scripts │ │ └── baset-assets-reader.js │ ├── src │ │ ├── App.css │ │ ├── App.spec.base.md │ │ ├── App.spec.tsx │ │ ├── App.tsx │ │ ├── index.css │ │ ├── index.tsx │ │ ├── logo.svg │ │ ├── mocks │ │ │ └── styled.ts │ │ └── registerServiceWorker.ts │ ├── tsconfig.json │ ├── tsconfig.prod.json │ ├── tsconfig.test.json │ ├── tslint.json │ └── yarn.lock ├── typescript-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base │ ├── index.spec.ts │ ├── index.ts │ ├── lib │ │ └── someCoolClass.ts │ ├── package-lock.json │ ├── package.json │ ├── pathImport.spec.base │ ├── pathImport.spec.ts │ ├── polyfill.ts │ └── tsconfig.json └── umd-like-dep-project │ ├── .basetrc │ ├── CHANGELOG.md │ ├── index.spec.base │ ├── index.spec.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── tsconfig.json └── tslint.json /.bettercodehub.yml: -------------------------------------------------------------------------------- 1 | component_depth: 2 2 | exclude: 3 | - /.vscode/.* 4 | - /scripts/.* 5 | - /docs/.* 6 | - /commitlint\.config\.js 7 | languages: 8 | - typescript 9 | - javascript 10 | 11 | - name: typescript 12 | production: 13 | exclude: 14 | - /tests/.*\.ts 15 | - /tests/.*\.tsx 16 | - /tests/.*\.spec\.md 17 | - /tests/.*\.spec\.base 18 | - /tests/.*\.spec\.base\.md 19 | test: 20 | include: 21 | - /tests/.*\.ts 22 | - /tests/.*\.tsx 23 | - /tests/.*\.spec\.md 24 | - /tests/.*\.spec\.base 25 | - /tests/.*\.spec\.base\.md 26 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | end_of_line = lf 11 | 12 | [*.md] 13 | max_line_length = off 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | ## Describe the bug 8 | 9 | 10 | ## To Reproduce 11 | Steps to reproduce the behavior: 12 | 1. Run `baset '...'` 13 | 2. Go to file '....' 14 | 4. See error 15 | 16 | ## Expected behavior 17 | 18 | 19 | ## Screenshots 20 | 21 | 22 | ## Environment 23 | 24 | - **OS:** _Example:_ *nix/win 25 | - **Node.js version:** _Example:_ 9.4.0 26 | - **npm version:** _Example:_ 5.6.0 27 | - **BaseT version:** _Example:_ 0.13.4 28 | - **BaseT config:** _Example:_ 29 | ```JSON 30 | { 31 | "specs": "**/*.spec.{js,jsx}", 32 | "bases": "**/*.spec.base.md", 33 | "plugins": { 34 | ".spec.jsx?$": { 35 | "readers": ["baset-reader-babel"], 36 | "resolvers": "baset-resolver-react", 37 | "baseliner": "baset-baseliner-md" 38 | } 39 | } 40 | } 41 | ``` 42 | 43 | ## Additional context 44 | 45 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | ## Is your feature request related to a problem? Please describe. 8 | 9 | 10 | ## Describe the solution you'd like 11 | 12 | 13 | ## Describe alternatives you've considered 14 | 15 | 16 | ## Additional context 17 | 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description of Change 2 | 3 | 4 | ## Pull Request check-list 5 | 6 | 7 | - [ ] Does the linter pass? 8 | - [ ] If this change fixes a bug (or a performance problem), is a regression test (or a benchmark) included? 9 | - [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | **/*/dist 5 | /dist 6 | **/*/build 7 | /build 8 | **/*/tmp 9 | /tmp 10 | **/*/out-tsc 11 | /out-tsc 12 | 13 | # dependencies 14 | **/*/node_modules 15 | /node_modules 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | /.vs 26 | /iac/.vs 27 | 28 | # IDE - VSCode 29 | .vscode/* 30 | !.vscode/settings.json 31 | !.vscode/tasks.json 32 | !.vscode/launch.json 33 | !.vscode/extensions.json 34 | !.vscode/cSpell.json 35 | 36 | # misc 37 | **/*/.sass-cache 38 | /.sass-cache 39 | **/*/connect.lock 40 | /connect.lock 41 | **/*/coverage 42 | /coverage 43 | **/*/libpeerconnection.log 44 | /libpeerconnection.log 45 | yarn-error.log 46 | *.iml 47 | npm-debug.log 48 | .soliumignore 49 | .soliumrc.json 50 | testem.log 51 | **/*/typings 52 | /typings 53 | 54 | # e2e 55 | **/*/e2e/*.js 56 | /e2e/*.js 57 | **/*/e2e/*.map 58 | /e2e/*.map 59 | 60 | # System Files 61 | .DS_Store 62 | Thumbs.db 63 | lerna-debug.log 64 | 65 | # tmp baseline 66 | **/*.spec.tmp.md 67 | **/*.spec.tmp.base 68 | **/*.spec.base.tmp.md 69 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules\\typescript\\lib", 3 | "cSpell.words": [ 4 | "exts" 5 | ] 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /docs/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ichulinda@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | 4 | 5 | 6 | 7 | - [Helpful things](#helpful-things) 8 | - [Creating Issues](#creating-issues) 9 | - [Bug Issues](#bug-issues) 10 | - [Developing](#developing) 11 | - [Initializing](#initializing) 12 | - [Building](#building) 13 | - [Testing](#testing) 14 | 15 | 16 | 17 | ## Helpful things 18 | 19 | We're open source! We love contributions! An ordered list of helpful things: 20 | 21 | 1. Patches with tests 22 | 2. Bare patches 23 | 3. Failing tests 24 | 4. Bug reports 25 | 5. Problem statements 26 | 6. Feature requests 27 | 28 | 29 | ## Creating Issues 30 | GitHub issues can be treated like a massive, communal todo list. If you notice something wrong, toss an issue in and we'll get to it! 31 | 32 | 33 | ### Bug Issues 34 | * The following things are helpful 35 | * js console or node logs 36 | * The following things should always be included 37 | * the steps it would take to reproduce the issue 38 | * what happened when you followed those steps 39 | * what you expected to happen that didn't 40 | 41 | ## Developing 42 | * Please follow linter warnings. 43 | * Optionally, add tests, we'd like to hit 100% code coverage. 44 | * We're using [commitizen](https://github.com/commitizen/cz-cli), so run `git cz` or `npm run commit` instead of usual commits for this repo. 45 | * Please write meaningful commit messages. Keep them somewhat short and meaningful. Commit messages like “meh”, “fix”, “lol” and so on are useless. Your are writing to your future self and everyone else. It’s important to be able to tell what a commit is all about from its message. 46 | 47 | “Write every commit message like the next person who reads it is an axe-wielding maniac who knows where you live” 48 | 49 | * Thank you for contributing! 50 | 51 | ### Initializing 52 | For initializing just run: 53 | ``` 54 | npm install 55 | ``` 56 | If you'll run only tasks from package.json you'll need no global dependency for developing this project. 57 | 58 | ### Building 59 | To build project run: 60 | ``` 61 | npm run build 62 | ``` 63 | or for watching: 64 | ``` 65 | npm run watch 66 | ``` 67 | 68 | ### Testing 69 | To test project run: 70 | ``` 71 | npm test 72 | ``` 73 | watching tests will be added later. 74 | -------------------------------------------------------------------------------- /docs/images/angular-docs-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/docs/images/angular-docs-screenshot.png -------------------------------------------------------------------------------- /docs/images/become_a_patron_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/docs/images/become_a_patron_button.png -------------------------------------------------------------------------------- /docs/images/logo.svg: -------------------------------------------------------------------------------- 1 | BASET logo -------------------------------------------------------------------------------- /docs/images/react-docs-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/docs/images/react-docs-screenshot.png -------------------------------------------------------------------------------- /docs/images/sprite-export-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/docs/images/sprite-export-sample.png -------------------------------------------------------------------------------- /docs/images/test-as-doc-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/docs/images/test-as-doc-example.png -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "./packages/*", 4 | "./tests/*" 5 | ], 6 | "version": "0.14.8", 7 | "command": { 8 | "bootstrap": { 9 | "hoist": "**" 10 | }, 11 | "publish": { 12 | "allowBranch": "master", 13 | "conventionalCommits": true, 14 | "githubRelease": true, 15 | "private": false, 16 | "ignoreChanges": [ 17 | "*.md", 18 | "LICENSE", 19 | "*.spec.*" 20 | ] 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "version": "0.2.1", 4 | "author": "Ihor Chulinda ", 5 | "license": "MIT", 6 | "repository": { 7 | "type": "git", 8 | "url": "git@github.com:Igmat/baset.git" 9 | }, 10 | "scripts": { 11 | "bootstrap": "lerna bootstrap", 12 | "postbootstrap": "node ./scripts/createBinSymlinks.js", 13 | "postinstall": "npm run bootstrap", 14 | "build": "lerna run build", 15 | "watch": "lerna run watch --parallel", 16 | "test": "lerna link && node ./packages/baset/bin/index.js", 17 | "accept": "node ./packages/baset/bin/index.js a", 18 | "help": "node ./packages/baset/bin/index.js --help", 19 | "doctoc": "doctoc README.md docs/CONTRIBUTING.md docs/Is_TDD_wrong.md docs/Is_TDD_wrong.RU.md", 20 | "cz": "git-cz", 21 | "prerelease": "npm run doctoc", 22 | "release": "lerna publish --yes" 23 | }, 24 | "devDependencies": { 25 | "@commitlint/cli": "7.6.1", 26 | "@commitlint/config-conventional": "7.6.0", 27 | "@types/cross-spawn": "^6.0.0", 28 | "commitizen": "^3.1.1", 29 | "cross-spawn": "^6.0.5", 30 | "cz-conventional-changelog": "^2.1.0", 31 | "doctoc": "^1.3.1", 32 | "git-url-parse": "^10.0.1", 33 | "husky": "^2.4.0", 34 | "lerna": "^3.14.1", 35 | "tslint": "^5.11.0", 36 | "typescript": "^3.5.1", 37 | "lint-staged": "7.3.0" 38 | }, 39 | "config": { 40 | "commitizen": { 41 | "path": "./node_modules/cz-conventional-changelog" 42 | } 43 | }, 44 | "lint-staged": { 45 | "*.ts": [ 46 | "tslint --fix --force", 47 | "git add" 48 | ], 49 | "*.tsx": [ 50 | "tslint --fix --force", 51 | "git add" 52 | ] 53 | }, 54 | "husky": { 55 | "hooks": { 56 | "precommit": "lint-staged", 57 | "commitmsg": "commitlint -e $GIT_PARAMS" 58 | } 59 | }, 60 | "baset": { 61 | "specs": "tests/*.spec.ts", 62 | "bases": "tests/*.base", 63 | "plugins": { 64 | ".spec.ts$": [ 65 | "./packages/baset-reader-ts", 66 | "./packages/baset-baseliner-json" 67 | ] 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-baseliner-json/badge.svg)](https://snyk.io/test/npm/baset-baseliner-json) 2 | 3 | # BaseT export plugin 4 | > Export reader plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-baseliner-json", 3 | "version": "0.14.8", 4 | "description": "JSON baseliner plugin for BaseT project.", 5 | "author": "Ihor Chulinda ", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "git@github.com:Igmat/baset.git" 10 | }, 11 | "keywords": [ 12 | "baset-baseliner-json", 13 | "baset-default-baseliner", 14 | "baseline", 15 | "unit-test", 16 | "test", 17 | "testing", 18 | "e2e-test" 19 | ], 20 | "main": "dist/index.js", 21 | "types": "dist/index.d.ts", 22 | "scripts": { 23 | "build": "npm run tslint && tsc", 24 | "watch": "npm run tslint && tsc -w", 25 | "tslint": "tslint -c tslint.json -p tsconfig.json", 26 | "test": "baset", 27 | "accept": "baset accept", 28 | "doctoc": "doctoc README.md", 29 | "prepublish": "npm run doctoc" 30 | }, 31 | "devDependencies": { 32 | "@types/node": "^10.10.0" 33 | }, 34 | "dependencies": { 35 | "baset-core": "^0.14.7" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractBaseliner, circularReference } from 'baset-core'; 2 | import { beautify } from './beautifier'; 3 | 4 | export default class ExportReader extends AbstractBaseliner { 5 | create = async (result: Promise[]) => { 6 | const results = await Promise.all(result); 7 | const isExportSingle = results.length === 1; 8 | 9 | return (!isExportSingle) 10 | ? beautify(results, undefined, 4, 20, isExportSingle) 11 | : beautify(results[0], undefined, 4, 20, isExportSingle); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-baseliner-json/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-baseliner-md/badge.svg)](https://snyk.io/test/npm/baset-baseliner-md) 2 | 3 | # BaseT md baseliner plugin 4 | > MD baseliner plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-baseliner-md", 3 | "version": "0.14.8", 4 | "description": "JSON baseliner plugin for BaseT project.", 5 | "author": "Ihor Chulinda ", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "git@github.com:Igmat/baset.git" 10 | }, 11 | "keywords": [ 12 | "baset-baseliner-md", 13 | "md", 14 | "markdown", 15 | "documentation", 16 | "baseline", 17 | "unit-test", 18 | "test", 19 | "testing", 20 | "e2e-test" 21 | ], 22 | "main": "dist/index.js", 23 | "types": "dist/index.d.ts", 24 | "scripts": { 25 | "build": "npm run tslint && tsc", 26 | "watch": "npm run tslint && tsc -w", 27 | "tslint": "tslint -c tslint.json -p tsconfig.json", 28 | "test": "baset", 29 | "accept": "baset accept", 30 | "doctoc": "doctoc README.md", 31 | "prepublish": "npm run doctoc" 32 | }, 33 | "devDependencies": { 34 | "@types/node": "^10.10.0", 35 | "@types/pixelmatch": "^4.0.0", 36 | "@types/pngjs": "^3.3.2" 37 | }, 38 | "dependencies": { 39 | "baset-baseliner-json": "^0.14.8", 40 | "baset-core": "^0.14.7", 41 | "clean-html": "^1.5.0", 42 | "pixelmatch": "^4.0.2", 43 | "pngjs": "^3.3.3", 44 | "remark-parse": "^5.0.0", 45 | "unified": "^7.0.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/src/types/clean-html.d.ts: -------------------------------------------------------------------------------- 1 | declare const beautify: { 2 | clean: any 3 | }; 4 | export = beautify; 5 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/src/types/remark-parse.d.ts: -------------------------------------------------------------------------------- 1 | declare const remarkParse: any; 2 | export = remarkParse; 3 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/src/types/unified.d.ts: -------------------------------------------------------------------------------- 1 | declare const unified: any; 2 | export = unified; 3 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-baseliner-md/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-cli/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-cli/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-cli/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-cli/badge.svg)](https://snyk.io/test/npm/baset-cli) 2 | 3 | # BaseT CLI 4 | > CLI for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/baset-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-cli", 3 | "version": "0.14.7", 4 | "description": "CLI for BaseT project.", 5 | "keywords": [ 6 | "baset-cli", 7 | "baseline", 8 | "unit-test", 9 | "test", 10 | "testing", 11 | "e2e-test" 12 | ], 13 | "author": "Ihor Chulinda ", 14 | "license": "MIT", 15 | "repository": { 16 | "type": "git", 17 | "url": "git@github.com:Igmat/baset.git" 18 | }, 19 | "main": "dist/index.js", 20 | "types": "dist/index.d.ts", 21 | "scripts": { 22 | "build": "npm run tslint && tsc", 23 | "watch": "npm run tslint && tsc -w", 24 | "tslint": "tslint -c tslint.json -p tsconfig.json", 25 | "test": "baset", 26 | "accept": "baset accept", 27 | "doctoc": "doctoc README.md", 28 | "prepublish": "npm run doctoc" 29 | }, 30 | "devDependencies": { 31 | "@types/find-up": "^2.1.1", 32 | "@types/glob": "^5.0.35", 33 | "@types/node": "^10.10.0", 34 | "@types/yargs": "^12.0.0" 35 | }, 36 | "dependencies": { 37 | "baset-core": "^0.14.7", 38 | "find-up": "^3.0.0", 39 | "glob": "^7.1.3", 40 | "glob-promise": "^3.4.0", 41 | "tap-diff": "^0.1.1", 42 | "yargs": "^12.0.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/baset-cli/src/commands/accept.ts: -------------------------------------------------------------------------------- 1 | import { Tester, utils } from 'baset-core'; 2 | import glob from 'glob-promise'; 3 | import { CommandModule } from 'yargs'; 4 | import { IGlobalArgs } from '../options'; 5 | 6 | interface IAcceptArgs extends IGlobalArgs { 7 | bases: string; 8 | } 9 | 10 | const acceptCommand: CommandModule<{}, IAcceptArgs> = { 11 | command: ['accept'], 12 | aliases: ['a'], 13 | describe: 'Accepting new baseline', 14 | builder: { 15 | bases: { 16 | alias: 'b', 17 | type: 'string', 18 | describe: 'Glob pattern for baseline files', 19 | default: '**/*.base', 20 | }, 21 | }, 22 | handler: async argv => { 23 | const baselines = await glob(utils.pathToTmp(argv.bases)); 24 | const tester = new Tester(argv.plugins, argv.options); 25 | const results = await Promise.all(tester.accept(baselines)); 26 | results.forEach(result => console.log(`Baseline ${result} is written.`)); 27 | process.exit(0); 28 | }, 29 | }; 30 | export = acceptCommand; 31 | -------------------------------------------------------------------------------- /packages/baset-cli/src/commands/scaffold.ts: -------------------------------------------------------------------------------- 1 | import { Scaffolder } from 'baset-core'; 2 | import glob from 'glob-promise'; 3 | import { CommandModule } from 'yargs'; 4 | import { IGlobalArgs } from '../options'; 5 | 6 | interface IScaffoldArgs extends IGlobalArgs { 7 | files: string; 8 | specs: string; 9 | } 10 | 11 | function complementArray(arrayA: T[], arrayB: T[]) { 12 | arrayA.forEach(match => { 13 | const index = arrayB.indexOf(match); 14 | 15 | if (index > -1) { 16 | arrayB.splice(index, 1); 17 | } 18 | }); 19 | } 20 | 21 | const scaffoldCommand: CommandModule<{}, IScaffoldArgs> = { 22 | command: ['scaffold'], 23 | aliases: ['s'], 24 | describe: 'Scaffolding new spec', 25 | builder: { 26 | files: { 27 | alias: 'f', 28 | type: 'string', 29 | describe: 'Glob pattern for project files', 30 | default: '**/*.js', 31 | }, 32 | specs: { 33 | alias: 's', 34 | type: 'string', 35 | describe: 'Glob pattern for spec files', 36 | default: '**/*.spec.js', 37 | }, 38 | }, 39 | handler: async argv => { 40 | const files = await glob(argv.files); 41 | const specs = await glob(argv.specs); 42 | complementArray(specs, files); 43 | const scaffolder = new Scaffolder(); 44 | const results = await Promise.all(scaffolder.scaffold(files)); 45 | results.forEach(result => result && console.log(`Spec "${result}" is scaffolded`)); 46 | }, 47 | }; 48 | export = scaffoldCommand; 49 | -------------------------------------------------------------------------------- /packages/baset-cli/src/commands/test.ts: -------------------------------------------------------------------------------- 1 | import { Tester } from 'baset-core'; 2 | import glob from 'glob-promise'; 3 | import { Writable } from 'stream'; 4 | import { CommandModule } from 'yargs'; 5 | import { IGlobalArgs } from '../options'; 6 | import { getTapStream } from '../TAP'; 7 | 8 | function filterNodeModules(filePath: string) { 9 | return !filePath.includes('node_modules'); 10 | } 11 | 12 | interface ITestArgs extends IGlobalArgs { 13 | bases: string; 14 | specs: string; 15 | reporter: string; 16 | isolateContext: boolean; 17 | } 18 | 19 | const testCommand: CommandModule<{}, ITestArgs> = { 20 | command: 'test', 21 | aliases: ['$0', 't'], 22 | describe: 'Creating temp baseline and comparing it to existing one', 23 | builder: { 24 | specs: { 25 | alias: 's', 26 | type: 'string', 27 | describe: 'Glob pattern for spec files', 28 | default: '**/*.spec.js', 29 | }, 30 | bases: { 31 | alias: 'b', 32 | type: 'string', 33 | describe: 'Glob pattern for baseline files', 34 | default: '**/*.base', 35 | }, 36 | reporter: { 37 | alias: 'r', 38 | type: 'string', 39 | describe: 'TAP reporter to use, `false` for plain output', 40 | default: 'tap-diff', 41 | }, 42 | isolateContext: { 43 | type: 'boolean', 44 | describe: 'Run each test in isolated context. ATTENTION: this will slow down your tests', 45 | default: false, 46 | }, 47 | }, 48 | handler: async argv => { 49 | let isSucceeded = true; 50 | const [allSpecs, allBaselines] = await Promise.all([glob(argv.specs), glob(argv.bases)]); 51 | const specs = allSpecs.filter(filterNodeModules); 52 | const baselines = allBaselines.filter(filterNodeModules); 53 | let reporterIsSkipped: boolean; 54 | try { 55 | reporterIsSkipped = JSON.parse(argv.reporter) === false; 56 | } catch (err) { 57 | reporterIsSkipped = !argv.reporter; 58 | } 59 | try { 60 | const outStream: Writable = (reporterIsSkipped) 61 | ? process.stdout 62 | : require(argv.reporter)(); 63 | if (!reporterIsSkipped) outStream.pipe(process.stdout); 64 | 65 | const { finish } = getTapStream(specs.length, outStream); 66 | 67 | const tester = new Tester(argv.plugins, argv.options, argv.isolateContext); 68 | 69 | const results = await finish(() => tester.test(specs, baselines)); 70 | isSucceeded = !(results.failed) && !(results.crashed); 71 | } catch (err) { 72 | isSucceeded = false; 73 | console.error(err); 74 | } 75 | process.exit(isSucceeded ? 0 : 1); 76 | }, 77 | }; 78 | export = testCommand; 79 | -------------------------------------------------------------------------------- /packages/baset-cli/src/index.ts: -------------------------------------------------------------------------------- 1 | import { sync } from 'find-up'; 2 | import fs from 'fs'; 3 | import * as yargs from 'yargs'; 4 | import { options } from './options'; 5 | const configPath = sync(['.basetrc', '.basetrc.json']); 6 | const config = configPath ? JSON.parse(fs.readFileSync(configPath, { encoding: 'utf8' })) : {}; 7 | 8 | export const cli = yargs 9 | .usage('$0 ') 10 | .commandDir('./commands') 11 | .options(options) 12 | .pkgConf('baset') 13 | .config(config) 14 | .help('h') 15 | .alias('help', 'h') 16 | .epilog('Made by Igmat.'); 17 | -------------------------------------------------------------------------------- /packages/baset-cli/src/types/glob-promise.d.ts: -------------------------------------------------------------------------------- 1 | import glob = require('glob') 2 | 3 | export = promise; 4 | 5 | declare const promise: Export 6 | 7 | declare type GlobPromise = (pattern: string, options?: glob.IOptions) => Promise 8 | 9 | declare interface Export extends GlobPromise { 10 | readonly glob: typeof glob 11 | readonly Glob: typeof glob.Glob 12 | readonly hasMagic: typeof glob.hasMagic 13 | readonly sync: typeof glob.sync 14 | readonly promise: GlobPromise 15 | } 16 | -------------------------------------------------------------------------------- /packages/baset-cli/src/types/tap-diff.d.ts: -------------------------------------------------------------------------------- 1 | declare const faucet: any; 2 | export default faucet; 3 | -------------------------------------------------------------------------------- /packages/baset-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-cli/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-console": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-core/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-core/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-core/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-core/badge.svg)](https://snyk.io/test/npm/baset-core) 2 | 3 | # BaseT Core 4 | > Core library for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/baset-core/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-core", 3 | "version": "0.14.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/baset-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-core", 3 | "version": "0.14.7", 4 | "description": "Core library for BaseT project.", 5 | "keywords": [ 6 | "baset-core", 7 | "baseline", 8 | "unit-test", 9 | "test", 10 | "testing", 11 | "e2e-test" 12 | ], 13 | "author": "Ihor Chulinda ", 14 | "license": "MIT", 15 | "repository": { 16 | "type": "git", 17 | "url": "git@github.com:Igmat/baset.git" 18 | }, 19 | "main": "dist/index.js", 20 | "types": "dist/index.d.ts", 21 | "scripts": { 22 | "build": "npm run tslint && tsc", 23 | "watch": "npm run tslint && tsc -w", 24 | "tslint": "tslint -c tslint.json -p tsconfig.json", 25 | "test": "baset", 26 | "accept": "baset accept", 27 | "doctoc": "doctoc README.md", 28 | "prepublish": "npm run doctoc" 29 | }, 30 | "devDependencies": { 31 | "@types/chance": "^1.0.1", 32 | "@types/node": "^10.10.0" 33 | }, 34 | "dependencies": { 35 | "baset-vm": "^0.14.4", 36 | "chance": "^1.0.16", 37 | "typescript": "^3.0.3" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/baset-core/src/abstractBaseliner.ts: -------------------------------------------------------------------------------- 1 | import { normalizeEndings } from './utils'; 2 | 3 | export interface ICompareResult { 4 | isEqual: boolean; 5 | expected: string; 6 | actual: string; 7 | errors: any[]; 8 | diff: { 9 | console: string; 10 | full: string; 11 | }; 12 | } 13 | 14 | export abstract class AbstractBaseliner { 15 | readonly ext: string = '.base'; 16 | abstract create: (result: Promise[]) => Promise; 17 | constructor(public options: any) { } 18 | compare = async (result: Promise[], baseline: Promise): Promise => { 19 | const [newBase, oldBase] = await Promise.all([this.create(result), baseline]); 20 | 21 | return { 22 | isEqual: normalizeEndings(newBase) === normalizeEndings(oldBase), 23 | expected: oldBase, 24 | actual: newBase, 25 | errors: [], 26 | diff: { 27 | console: '', 28 | full: '', 29 | }, 30 | }; 31 | } 32 | } 33 | 34 | export type IBaselinerConstructor = 35 | new (options: any) => AbstractBaseliner; 36 | -------------------------------------------------------------------------------- /packages/baset-core/src/abstractEnvironment.ts: -------------------------------------------------------------------------------- 1 | import { IDictionary } from './utils'; 2 | 3 | export abstract class AbstractEnvironment { 4 | constructor(public options: any) { } 5 | abstract getContextImport(sandbox: IDictionary): Promise; 6 | abstract dispose(): void; 7 | } 8 | 9 | export type IEnvironmentConstructor = 10 | new (options: any) => AbstractEnvironment; 11 | -------------------------------------------------------------------------------- /packages/baset-core/src/abstractReader.ts: -------------------------------------------------------------------------------- 1 | import { CompilerFunction, ResolverFunction } from 'baset-vm'; 2 | 3 | export interface IHookOptions { 4 | exts?: string[]; 5 | ignoreNodeModules?: boolean; 6 | matcher?(filename: string): boolean; 7 | } 8 | export type AddHook = (hook: CompilerFunction, options?: IHookOptions) => void; 9 | export type AddFileResolver = (fn: (original: ResolverFunction) => ResolverFunction) => void; 10 | 11 | export abstract class AbstractReader { 12 | abstract read: (filePath: string, result: Promise) => Promise; 13 | abstract registerHook: (addHook: AddHook, addFileResolver: AddFileResolver) => void; 14 | constructor(public options: any) { } 15 | } 16 | 17 | export type IReaderConstructor = 18 | new (options: any) => AbstractReader; 19 | -------------------------------------------------------------------------------- /packages/baset-core/src/abstractResolver.ts: -------------------------------------------------------------------------------- 1 | import { NodeVM } from 'baset-vm'; 2 | import { IDictionary } from './utils'; 3 | 4 | export abstract class AbstractResolver { 5 | abstract match: (obj: any, context: NodeVM, sandbox: IDictionary) => Promise; 6 | abstract resolve: (obj: any, context: NodeVM, sandbox: IDictionary) => Promise; 7 | constructor(public options: any) { } 8 | } 9 | 10 | export type IResolverConstructor = 11 | new (options: any) => AbstractResolver; 12 | -------------------------------------------------------------------------------- /packages/baset-core/src/dataTypes.ts: -------------------------------------------------------------------------------- 1 | export const image = Symbol('image'); 2 | export const html = Symbol('html'); 3 | export const error = Symbol('error'); 4 | -------------------------------------------------------------------------------- /packages/baset-core/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as dataTypes from './dataTypes'; 2 | import * as tap from './tap'; 3 | import * as utils from './utils'; 4 | 5 | export { AbstractBaseliner } from './abstractBaseliner'; 6 | export { AbstractReader, AddHook, AddFileResolver } from './abstractReader'; 7 | export { AbstractResolver } from './abstractResolver'; 8 | export { AbstractEnvironment } from './abstractEnvironment'; 9 | export { circularReference, ITestGroupOptions } from './testGroup'; 10 | export { Tester } from './tester'; 11 | export { Scaffolder } from './scaffolder'; 12 | export { TestError } from './testError'; 13 | export { 14 | utils, 15 | dataTypes, 16 | tap, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/baset-core/src/tap.ts: -------------------------------------------------------------------------------- 1 | import { TestError } from './testError'; 2 | 3 | export interface ITestOptions { 4 | index: number; 5 | comment?: string | string[]; 6 | } 7 | export interface IPassedTestOptions extends ITestOptions { 8 | passed: true; 9 | skip: boolean; 10 | } 11 | export type PassedTestOptions = IPassedTestOptions; 12 | export interface IFailedTestOptions extends ITestOptions { 13 | passed: false; 14 | } 15 | export interface IErrorTestOptions extends IFailedTestOptions { 16 | error: TestError | Error[]; 17 | todo?: false; 18 | } 19 | export interface ITodoTestOptions extends IFailedTestOptions { 20 | todo: true; 21 | } 22 | export type FailedTestOptions = IErrorTestOptions | ITodoTestOptions; 23 | export type Options = PassedTestOptions | FailedTestOptions; 24 | export interface IStats { 25 | passed: number; 26 | failed: number; 27 | skipped: number; 28 | todo: number; 29 | crashed: number; 30 | } 31 | -------------------------------------------------------------------------------- /packages/baset-core/src/testError.ts: -------------------------------------------------------------------------------- 1 | export class TestError extends Error { 2 | constructor(public data: { actual: string; expected: string }, message = "actual doesn't match expected") { 3 | super(message); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/baset-core/src/tester.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import { isPrimitive } from 'util'; 3 | import { ICompareResult } from './abstractBaseliner'; 4 | import { Options } from './tap'; 5 | import { TestError } from './testError'; 6 | import { ITestGroupOptions, TestGroup } from './testGroup'; 7 | import { IDictionary, isExists, pathToTmp, readFile, tmpToPath, unlink, writeFile } from './utils'; 8 | 9 | export class Tester { 10 | private testGroups: TestGroup[]; 11 | 12 | // tslint:disable-next-line:no-any 13 | constructor(plugins: IDictionary, pluginsOptions: IDictionary, private isolateContext = false) { 14 | this.testGroups = Object.keys(plugins) 15 | .map(key => new TestGroup( 16 | key, 17 | isolateContext 18 | ? { 19 | ...plugins[key], 20 | isolateContext, 21 | } 22 | : plugins[key], 23 | pluginsOptions)); 24 | } 25 | 26 | test(specs: string[], baselines: string[]) { 27 | return specs.map(this.testSpec); 28 | } 29 | accept(files: string[]) { 30 | return files.map(this.acceptBase); 31 | } 32 | 33 | private testSpec = async (name: string, index: number) => { 34 | const reader = this.testGroups.find(group => group.match(name)); 35 | if (!reader) throw new Error(`No reader defined for ${name}!`); 36 | const testResult = await reader.test(name); 37 | await writeFile(pathToTmp(testResult.path), testResult.output.actual); 38 | 39 | return { 40 | name, 41 | options: this.convertToOptions(testResult.output, index), 42 | }; 43 | } 44 | 45 | private acceptBase = async (name: string) => { 46 | const baseline = await readFile(path.resolve(name), { encoding: 'utf-8' }); 47 | const filePath = tmpToPath(name); 48 | await writeFile(path.resolve(filePath), baseline); 49 | await unlink(path.resolve(name)); 50 | 51 | return filePath; 52 | } 53 | 54 | private convertToOptions(result: ICompareResult, index: number): Options { 55 | return result.isEqual 56 | ? { 57 | index, 58 | passed: true, 59 | skip: false, 60 | comment: 'Temp baseline is written.', 61 | } 62 | : result.errors.length 63 | ? { 64 | index, 65 | passed: false, 66 | error: result.errors, 67 | } 68 | : { 69 | index, 70 | passed: false, 71 | error: new TestError(result), 72 | }; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /packages/baset-core/src/utils.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import path from 'path'; 3 | import { promisify } from 'util'; 4 | 5 | export const writeFile = promisify(fs.writeFile); 6 | export const readFile = promisify(fs.readFile); 7 | export const isExists = promisify(fs.exists); 8 | export const unlink = promisify(fs.unlink); 9 | 10 | export interface IDictionary { 11 | [index: string]: T; 12 | } 13 | 14 | export function pathToTmp(value: string) { 15 | const ext = path.extname(value); 16 | 17 | return value.replace(new RegExp(`${ext}$`), `.tmp${ext}`); 18 | } 19 | export function tmpToPath(value: string) { 20 | return value.replace(/.tmp./, '.'); 21 | } 22 | 23 | export function normalizeEndings(value: string) { 24 | return value.replace(/\r?\n|\r/g, '\n').trim(); 25 | } 26 | -------------------------------------------------------------------------------- /packages/baset-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-core/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/baset-env-browser/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-env-browser/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-env-browser/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-env-browser/badge.svg)](https://snyk.io/test/npm/baset-env-browser) 2 | 3 | # BaseT browser environment plugin 4 | > Browser environment plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | 11 | - [Installation and usage](#installation-and-usage) 12 | 13 | 14 | 15 | ## Installation and usage 16 | Run: 17 | ``` 18 | npm install --save-dev baset-env-browser 19 | ``` 20 | and adding next lines to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 21 | ```JSON 22 | ".spec.js$": ["baset-env-browser", "baset-baseliner-json"], // JavaScript 23 | ".spec.ts$": ["baset-env-browser", "baset-reader-ts", "baset-baseliner-json"] // TypeScript 24 | ``` 25 | You may also use static files server, by specifying at least one of following options, 26 | ```JSON 27 | "baset-env-browser": { 28 | "serverPort": 1337, // port that will be used for serving files, 1337 is default value 29 | "staticFolder": "./path/to/your/static/files" // root folder of your files, current working directory by default 30 | } 31 | ``` 32 | This config will run [express.static server](http://expressjs.com/en/4x/api.html#express.static) at `http://localhost:1337/` that will serve files from `staticFolder`. 33 | In most cases it's not needed, but sometimes (e.g. for [PIXI loaders](http://pixijs.download/dev/docs/PIXI.loaders.Loader.html)) it could be necessary, because framework/library may heavily depend on fetching some files from server. 34 | -------------------------------------------------------------------------------- /packages/baset-env-browser/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-env-browser", 3 | "version": "0.14.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "12.0.7", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.7.tgz", 10 | "integrity": "sha512-1YKeT4JitGgE4SOzyB9eMwO0nGVNkNEsm9qlIt1Lqm/tG2QEiSMTD4kS3aO6L+w5SClLVxALmIBESK6Mk5wX0A==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/baset-env-browser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-env-browser", 3 | "version": "0.14.7", 4 | "description": "Browser environment for BaseT project.", 5 | "keywords": [ 6 | "baset-env-browser", 7 | "jsdom", 8 | "baseline", 9 | "unit-test", 10 | "test", 11 | "testing", 12 | "e2e-test" 13 | ], 14 | "author": "Ihor Chulinda ", 15 | "license": "MIT", 16 | "repository": { 17 | "type": "git", 18 | "url": "git@github.com:Igmat/baset.git" 19 | }, 20 | "main": "dist/index.js", 21 | "types": "dist/index.d.ts", 22 | "scripts": { 23 | "build": "npm run tslint && tsc", 24 | "watch": "npm run tslint && tsc -w", 25 | "tslint": "tslint -c tslint.json -p tsconfig.json", 26 | "test": "baset", 27 | "accept": "baset accept", 28 | "doctoc": "doctoc README.md", 29 | "prepublish": "npm run doctoc" 30 | }, 31 | "devDependencies": { 32 | "@types/express": "^4.17.0", 33 | "@types/jsdom": "^12.2.3", 34 | "@types/node": "^12.0.7" 35 | }, 36 | "dependencies": { 37 | "baset-core": "^0.14.7", 38 | "canvas": "^2.5.0", 39 | "express": "^4.17.1", 40 | "jsdom": "^15.1.1" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/baset-env-browser/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractEnvironment, utils } from 'baset-core'; 2 | import express from 'express'; 3 | import { Server } from 'http'; 4 | import path from 'path'; 5 | 6 | export interface IBrowserEnvOptions { 7 | staticFolder?: string; 8 | serverPort?: number; 9 | } 10 | 11 | export default class BrowserEnv extends AbstractEnvironment { 12 | private serveUrl = 'about:blank'; 13 | private server?: Promise; 14 | constructor(public options: IBrowserEnvOptions) { 15 | super(options); 16 | if (options && (options.staticFolder || options.serverPort)) { 17 | const port = options.serverPort || 1337; 18 | const folder = options.staticFolder || process.cwd(); 19 | this.serveUrl = `http://localhost:${port}/`; 20 | 21 | const app = express(); 22 | app.use('/', express.static(folder)); 23 | this.server = new Promise(resolve => resolve(app.listen(port))); 24 | } 25 | } 26 | async getContextImport(sandbox: utils.IDictionary) { 27 | sandbox.basetBrowserEnv__StaticUrl = this.serveUrl; 28 | if (this.server) await this.server; 29 | 30 | return path.resolve(__dirname, 'runInContext').split('\\').join('/'); 31 | } 32 | async dispose() { 33 | if (!this.server) return; 34 | const server = await this.server; 35 | server.close(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/baset-env-browser/src/runInContext.ts: -------------------------------------------------------------------------------- 1 | import { JSDOM } from 'jsdom'; 2 | declare const basetSandbox: { basetBrowserEnv__StaticUrl: string }; 3 | 4 | const dom = new JSDOM('', { 5 | url: basetSandbox.basetBrowserEnv__StaticUrl, 6 | resources: 'usable', 7 | pretendToBeVisual: true, 8 | 9 | }); 10 | Object.setPrototypeOf(global, dom.window); 11 | -------------------------------------------------------------------------------- /packages/baset-env-browser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-env-browser/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-reader-babel/badge.svg)](https://snyk.io/test/npm/baset-reader-babel) 2 | 3 | # BaseT Babel plugin 4 | > Babel reader plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | - [Installation and usage](#installation-and-usage) 11 | 12 | 13 | 14 | ## Installation and usage 15 | Run: 16 | ``` 17 | npm install --save-dev baset-reader-babel 18 | ``` 19 | and adding next line to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 20 | ```JSON 21 | ".spec.jsx?$": ["baset-reader-babel", "baset-baseliner-json"] 22 | ``` 23 | You may also specify additional options for this plugin under `baset.options` section in your `package.json` or `options` section in your `.basetrc`/`.basetrc.json`: 24 | ```JavaScript 25 | "baset-reader-babel": { 26 | // by default this reader uses the same strategy for resolving configuration 27 | // as babel, but you may want to specify some additional settings only for tests 28 | // this options gives you such an opportunity 29 | "config": { 30 | // your additional configuration for babel 31 | }, 32 | // by default any files inside node_modules are explicitly ignored 33 | // but in some cases you may want to transpile them as well, 34 | // in order to do so, just set this option to true 35 | "includeNodeModules": true 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-reader-babel", 3 | "version": "0.14.7", 4 | "description": "Babel reader plugin for BaseT project.", 5 | "keywords": [ 6 | "baset-reader-babel", 7 | "baset-plugin-babel", 8 | "babel", 9 | "ESnext", 10 | "ES6", 11 | "ES2015", 12 | "ES2016", 13 | "baseline", 14 | "unit-test", 15 | "test", 16 | "testing", 17 | "e2e-test" 18 | ], 19 | "author": "Ihor Chulinda ", 20 | "license": "MIT", 21 | "repository": { 22 | "type": "git", 23 | "url": "git@github.com:Igmat/baset.git" 24 | }, 25 | "main": "dist/index.js", 26 | "types": "dist/index.d.ts", 27 | "scripts": { 28 | "build": "npm run tslint && tsc", 29 | "watch": "npm run tslint && tsc -w", 30 | "tslint": "tslint -c tslint.json -p tsconfig.json", 31 | "test": "baset", 32 | "accept": "baset accept", 33 | "doctoc": "doctoc README.md", 34 | "prepublish": "npm run doctoc" 35 | }, 36 | "devDependencies": { 37 | "@types/babel-core": "^6.25.5", 38 | "@types/find-up": "^2.1.1", 39 | "@types/lodash": "^4.14.116", 40 | "@types/node": "^10.10.0" 41 | }, 42 | "dependencies": { 43 | "babel-core": "^6.26.3", 44 | "baset-core": "^0.14.7", 45 | "find-up": "^3.0.0", 46 | "lodash": "^4.17.11" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/src/index.ts: -------------------------------------------------------------------------------- 1 | import { OptionManager, transform, util } from 'babel-core'; 2 | import { AbstractReader, AddFileResolver, AddHook, utils } from 'baset-core'; 3 | import { sync } from 'find-up'; 4 | import fs from 'fs'; 5 | import path from 'path'; 6 | 7 | export interface IBabelReaderOptions { 8 | config: any; 9 | includeNodeModules?: boolean; 10 | } 11 | export default class BabelReader extends AbstractReader { 12 | private exts = [...util.canCompile.EXTENSIONS]; 13 | private config: any; 14 | constructor(public options: IBabelReaderOptions = { config: {} }) { 15 | super(options); 16 | 17 | this.config = options.config; 18 | } 19 | 20 | read = async (filePath: string, spec: Promise) => { 21 | const ext = path.extname(filePath); 22 | const sources = await spec; 23 | 24 | return (sources instanceof Array) 25 | ? sources.map((src, index) => this.compile(src, `${filePath}.${index}${ext}`)) 26 | : this.compile(sources, filePath); 27 | } 28 | registerHook = (addHook: AddHook, addFileResolver: AddFileResolver) => { 29 | addHook(this.compile, { 30 | exts: this.exts, 31 | matcher: filename => 32 | (this.options && this.options.includeNodeModules) || 33 | !filename.includes('node_modules'), 34 | }); 35 | }; 36 | 37 | private compile = (code: string, filename: string) => { 38 | const opts = new OptionManager().init({ 39 | sourceRoot: path.dirname(filename), 40 | ...this.config, 41 | filename, 42 | }); 43 | 44 | if (opts === null) return code; 45 | 46 | const result = transform(code, opts); 47 | 48 | return result.code || ''; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/src/types/babel-core-extension.d.ts: -------------------------------------------------------------------------------- 1 | import babelCore from 'babel-core'; 2 | 3 | declare module 'babel-core' { 4 | const OptionManager: any; 5 | const util: any; 6 | } 7 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-reader-babel/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-reader-md/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-reader-md/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 8 | 9 | **Note:** Version bump only for package baset-reader-md 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 17 | 18 | **Note:** Version bump only for package baset-reader-md 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 26 | 27 | **Note:** Version bump only for package baset-reader-md 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 35 | 36 | **Note:** Version bump only for package baset-reader-md 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 44 | 45 | **Note:** Version bump only for package baset-reader-md 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 53 | 54 | 55 | 56 | 57 | **Note:** Version bump only for package baset-reader-md 58 | 59 | 60 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 61 | 62 | 63 | 64 | 65 | **Note:** Version bump only for package baset-reader-md 66 | 67 | 68 | ## [0.13.5](https://github.com/Igmat/baset/compare/v0.13.4...v0.13.5) (2018-06-08) 69 | 70 | 71 | 72 | 73 | **Note:** Version bump only for package baset-reader-md 74 | 75 | 76 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 77 | 78 | 79 | 80 | 81 | **Note:** Version bump only for package baset-reader-md 82 | 83 | 84 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 85 | 86 | 87 | 88 | 89 | **Note:** Version bump only for package baset-reader-md 90 | 91 | 92 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 93 | 94 | 95 | 96 | 97 | **Note:** Version bump only for package baset-reader-md 98 | 99 | 100 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 101 | 102 | 103 | ### Features 104 | 105 | * **reader-md:** initial simple implementation ([6a718eb](https://github.com/Igmat/baset/commit/6a718eb)), closes [#11](https://github.com/Igmat/baset/issues/11) 106 | -------------------------------------------------------------------------------- /packages/baset-reader-md/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-reader-md/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-reader-md/badge.svg)](https://snyk.io/test/npm/baset-reader-md) 2 | 3 | # BaseT MarkDown reader plugin 4 | > MarkDown reader plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | - [Installation and usage](#installation-and-usage) 11 | 12 | 13 | 14 | ## Installation and usage 15 | Run: 16 | ``` 17 | npm install --save-dev baset-reader-md 18 | ``` 19 | and adding next line to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 20 | ```JSON 21 | ".spec.md$": ["baset-reader-md", "baset-baseliner-json"] 22 | ``` 23 | There are no specific options for this plugin right now. 24 | -------------------------------------------------------------------------------- /packages/baset-reader-md/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-reader-md", 3 | "version": "0.13.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "10.10.0", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.10.0.tgz", 10 | "integrity": "sha512-0V36JTaif20jrbTbZeKqnI4R8nLVE8Ah/u9dQT5jIKXjW51/4ipi/B8Xon1ZiEHATYpgLNoBw2LFfdBMoA5Fzg==", 11 | "dev": true 12 | }, 13 | "abbrev": { 14 | "version": "1.1.1", 15 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", 16 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" 17 | }, 18 | "markdown": { 19 | "version": "0.5.0", 20 | "resolved": "https://registry.npmjs.org/markdown/-/markdown-0.5.0.tgz", 21 | "integrity": "sha1-KCBbVlqK51kt4gdGPWY33BgnIrI=", 22 | "requires": { 23 | "nopt": "~2.1.1" 24 | } 25 | }, 26 | "nopt": { 27 | "version": "2.1.2", 28 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.1.2.tgz", 29 | "integrity": "sha1-bMzZd7gBMqB3MdbozljCyDA8+a8=", 30 | "requires": { 31 | "abbrev": "1" 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/baset-reader-md/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-reader-md", 3 | "version": "0.14.7", 4 | "description": "MarkDown reader plugin for BaseT project.", 5 | "keywords": [ 6 | "baset-reader-md", 7 | "markdown", 8 | "md", 9 | "baseline", 10 | "unit-test", 11 | "test", 12 | "testing", 13 | "e2e-test" 14 | ], 15 | "author": "Ihor Chulinda ", 16 | "license": "MIT", 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:Igmat/baset.git" 20 | }, 21 | "main": "dist/index.js", 22 | "types": "dist/index.d.ts", 23 | "scripts": { 24 | "build": "npm run tslint && tsc", 25 | "watch": "npm run tslint && tsc -w", 26 | "tslint": "tslint -c tslint.json -p tsconfig.json", 27 | "test": "baset", 28 | "accept": "baset accept", 29 | "doctoc": "doctoc README.md", 30 | "prepublish": "npm run doctoc" 31 | }, 32 | "devDependencies": { 33 | "@types/node": "^10.10.0" 34 | }, 35 | "dependencies": { 36 | "baset-core": "^0.14.7", 37 | "markdown": "^0.5.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/baset-reader-md/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractReader, utils } from 'baset-core'; 2 | import { markdown } from 'markdown'; 3 | 4 | interface INode { 5 | index: number; 6 | name: string; 7 | level: number; 8 | } 9 | interface IRoot extends INode { 10 | codeBlocks: string[]; 11 | } 12 | interface ISection extends IRoot { 13 | subSections: ISection[]; 14 | } 15 | function getCodeBlocks(content: any): any { 16 | if (!Array.isArray(content)) return undefined; 17 | if (content[0] === 'inlinecode' && 18 | content[1] && 19 | (content[1].startsWith('TypeScript\n') || content[1].startsWith('JavaScript\n'))) return content[1]; 20 | 21 | return content.map(getCodeBlocks) 22 | .filter(blocks => !!blocks && (!Array.isArray(blocks) || blocks.length)); 23 | } 24 | function getSubs(list: T[], index: number, nodes: INode[]) { 25 | return list 26 | .slice(nodes[index].index + 1, (index + 1 < nodes.length) 27 | ? nodes[index + 1].index 28 | : list.length); 29 | } 30 | function listToTree(sections: IRoot[]): ISection[] { 31 | return sections 32 | .filter(section => section.level === sections[0].level) 33 | .map(root => ({ 34 | ...root, 35 | index: sections.indexOf(root), 36 | })) 37 | .map((root, index, roots) => ({ 38 | ...root, 39 | subSections: listToTree(getSubs(sections, index, roots)), 40 | })); 41 | } 42 | function concatCodeBlocks(sections: ISection[]): string[] { 43 | return sections 44 | .map(section => section.codeBlocks 45 | .map(codeBlock => 46 | section.subSections.length 47 | ? concatCodeBlocks(section.subSections) 48 | .map(concatedBlocks => clearCodeBlock(codeBlock) + concatedBlocks) 49 | : [clearCodeBlock(codeBlock)]) 50 | .reduce((prev, current) => [...prev, ...current], [])) 51 | .reduce((prev, current) => [...prev, ...current], []); 52 | } 53 | function clearCodeBlock(codeBlock: string) { 54 | return codeBlock.slice('TypeScript\n'.length); 55 | } 56 | export default class MarkDownReader extends AbstractReader { 57 | private exts = ['.md']; 58 | registerHook = () => { /* this reader doesn't need a hook */ }; // TODO: probably hook registering should be optional? 59 | read = async (filePath: string, result: Promise) => { 60 | const spec = await result; 61 | if (Array.isArray(spec)) throw new Error('MarkDown reader have to be first in readers chain.'); 62 | 63 | const mdTree: any[][] = markdown.parse(spec); 64 | const sections = mdTree 65 | .filter(node => node[0] === 'header') 66 | .map(header => ({ 67 | level: header[1].level, 68 | name: header[2], 69 | index: mdTree.indexOf(header), 70 | })) 71 | .map((header, index, headers) => ({ 72 | ...header, 73 | codeBlocks: getSubs(mdTree, index, headers) 74 | .map(getCodeBlocks) 75 | .reduce((prev, current) => [...prev, ...current], []), 76 | })); 77 | const sectionTree = listToTree(sections); 78 | 79 | return concatCodeBlocks(sectionTree); 80 | }; 81 | } 82 | -------------------------------------------------------------------------------- /packages/baset-reader-md/src/types/markdown.d.ts: -------------------------------------------------------------------------------- 1 | declare const markdown: any; 2 | export { 3 | markdown 4 | }; 5 | -------------------------------------------------------------------------------- /packages/baset-reader-md/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-reader-md/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-reader-ts/badge.svg)](https://snyk.io/test/npm/baset-reader-ts) 2 | 3 | # BaseT TypeScript plugin 4 | > TypeScript reader plugin for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | - [Installation and usage](#installation-and-usage) 11 | 12 | 13 | 14 | ## Installation and usage 15 | Run: 16 | ``` 17 | npm install --save-dev baset-reader-ts 18 | ``` 19 | and adding next line to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 20 | ```JSON 21 | ".spec.ts$": ["baset-reader-ts", "baset-baseliner-json"] 22 | ``` 23 | You may also specify additional options for this plugin under `baset.options` section in your `package.json` or `options` section in your `.basetrc`/`.basetrc.json`: 24 | ```JavaScript 25 | "baset-reader-ts": { 26 | "config": "./tsconfig.json" // path to your config 27 | } 28 | ``` 29 | or 30 | ```JavaScript 31 | "baset-reader-ts": { 32 | "config": { 33 | "compilerOptions": { 34 | "target": "es2015", 35 | "module": "commonjs", 36 | // and any other options for compiler 37 | } 38 | } 39 | } 40 | ``` 41 | Obviously, not every option for TS compiler will have noticeable impact on tests. 42 | 43 | Full list of available compiler options you may find at [official TS documentation](https://www.typescriptlang.org/docs/handbook/compiler-options.html) 44 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-reader-ts", 3 | "version": "0.14.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-reader-ts", 3 | "version": "0.14.7", 4 | "description": "TypeScript reader plugin for BaseT project.", 5 | "keywords": [ 6 | "baset-reader-ts", 7 | "baset-plugin-ts", 8 | "typescript", 9 | "baseline", 10 | "unit-test", 11 | "test", 12 | "testing", 13 | "e2e-test" 14 | ], 15 | "author": "Ihor Chulinda ", 16 | "license": "MIT", 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:Igmat/baset.git" 20 | }, 21 | "main": "dist/index.js", 22 | "types": "dist/index.d.ts", 23 | "scripts": { 24 | "build": "npm run tslint && tsc", 25 | "watch": "npm run tslint && tsc -w", 26 | "tslint": "tslint -c tslint.json -p tsconfig.json", 27 | "test": "baset", 28 | "accept": "baset accept", 29 | "doctoc": "doctoc README.md", 30 | "prepublish": "npm run doctoc" 31 | }, 32 | "devDependencies": { 33 | "@types/find-up": "^2.1.1", 34 | "@types/node": "^10.10.0" 35 | }, 36 | "dependencies": { 37 | "baset-core": "^0.14.7", 38 | "find-up": "^3.0.0", 39 | "tsconfig-paths": "^3.6.0", 40 | "typescript": "^3.0.3" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractReader, AddFileResolver, AddHook, utils } from 'baset-core'; 2 | import { sync } from 'find-up'; 3 | import * as fs from 'fs'; 4 | import * as path from 'path'; 5 | import { createMatchPath } from 'tsconfig-paths'; 6 | import { CompilerOptions, transpile, transpileModule } from 'typescript'; 7 | 8 | export interface ITypeScriptReaderOptions { 9 | config: string | { compilerOptions: CompilerOptions }; 10 | } 11 | export default class TypeScriptReader extends AbstractReader { 12 | private exts = ['.ts']; 13 | private config: { compilerOptions: CompilerOptions }; 14 | private absoluteBaseUrl: string; 15 | constructor(public pluginsOptions: ITypeScriptReaderOptions) { 16 | super(pluginsOptions); 17 | const config = (!pluginsOptions) 18 | ? (() => { 19 | const configPath = sync('tsconfig.json'); 20 | if (!configPath) throw new Error("We can't find TS config file for your tests"); 21 | 22 | return configPath; 23 | })() 24 | : pluginsOptions.config; 25 | 26 | this.config = (typeof config === 'string') 27 | ? require(path.resolve(config)) 28 | : config; 29 | 30 | this.absoluteBaseUrl = path.resolve(this.config.compilerOptions.baseUrl || ''); 31 | const { jsx, allowJs } = this.config.compilerOptions; 32 | if (jsx) this.exts.push('.tsx'); 33 | if (allowJs) this.exts.push('.js'); 34 | if (allowJs && jsx) this.exts.push('.jsx'); 35 | } 36 | 37 | read = async (filePath: string, spec: Promise) => { 38 | const ext = path.extname(filePath); 39 | const sources = await spec; 40 | 41 | return (sources instanceof Array) 42 | ? sources.map((src, index) => this.compile(src, `${filePath}.${index}${ext}`)) 43 | : this.compile(sources, filePath); 44 | } 45 | registerHook = (addHook: AddHook, addFileResolver: AddFileResolver) => { 46 | const matchPath = createMatchPath( 47 | this.absoluteBaseUrl, 48 | this.config.compilerOptions.paths || {}, 49 | ); 50 | addHook(this.compile, { exts: this.exts, matcher: () => true }); 51 | addFileResolver(original => 52 | (request: string) => { 53 | const found = matchPath(request, undefined, undefined, this.exts); 54 | 55 | return found 56 | ? original(found) 57 | : original(request); 58 | }); 59 | }; 60 | 61 | private compile = (code: string, filename: string) => transpileModule(code, { 62 | compilerOptions: this.config.compilerOptions, 63 | fileName: filename, 64 | }).outputText; 65 | } 66 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-reader-ts/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 8 | 9 | **Note:** Version bump only for package baset-resolver-pixi 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 17 | 18 | **Note:** Version bump only for package baset-resolver-pixi 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 26 | 27 | **Note:** Version bump only for package baset-resolver-pixi 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 35 | 36 | **Note:** Version bump only for package baset-resolver-pixi 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 44 | 45 | **Note:** Version bump only for package baset-resolver-pixi 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 53 | 54 | 55 | ### Bug Fixes 56 | 57 | * **resolver-pixi:** changes for work with reworked vm ([749501b](https://github.com/Igmat/baset/commit/749501b)) 58 | 59 | 60 | 61 | 62 | 63 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 64 | 65 | 66 | 67 | 68 | **Note:** Version bump only for package baset-resolver-pixi 69 | 70 | 71 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 72 | 73 | 74 | 75 | 76 | **Note:** Version bump only for package baset-resolver-pixi 77 | 78 | 79 | ## [0.13.3](https://github.com/Igmat/baset/compare/v0.13.2...v0.13.3) (2018-06-08) 80 | 81 | 82 | 83 | 84 | **Note:** Version bump only for package baset-resolver-pixi 85 | 86 | 87 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 88 | 89 | 90 | 91 | 92 | **Note:** Version bump only for package baset-resolver-pixi 93 | 94 | 95 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 96 | 97 | 98 | 99 | 100 | **Note:** Version bump only for package baset-resolver-pixi 101 | 102 | 103 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 104 | 105 | 106 | 107 | 108 | **Note:** Version bump only for package baset-resolver-pixi 109 | 110 | 111 | ## [0.11.1](https://github.com/Igmat/baset/compare/v0.11.0...v0.11.1) (2018-03-15) 112 | 113 | 114 | 115 | 116 | **Note:** Version bump only for package baset-resolver-pixi 117 | 118 | 119 | # [0.11.0](https://github.com/Igmat/baset/compare/v0.10.0...v0.11.0) (2018-03-08) 120 | 121 | 122 | 123 | 124 | **Note:** Version bump only for package baset-resolver-pixi 125 | 126 | 127 | # [0.10.0](https://github.com/Igmat/baset/compare/v0.9.1...v0.10.0) (2018-03-07) 128 | 129 | 130 | 131 | 132 | **Note:** Version bump only for package baset-resolver-pixi 133 | 134 | 135 | # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) 136 | 137 | 138 | ### Bug Fixes 139 | 140 | * **resolver-pixi:** explicit colorType set ([28722bc](https://github.com/Igmat/baset/commit/28722bc)) 141 | * **resolver-pixi:** save images in rgb without a-channel ([dfe511d](https://github.com/Igmat/baset/commit/dfe511d)) 142 | * **resolver-pixi:** use of pngjs for correct base64 strings ([1ed4e34](https://github.com/Igmat/baset/commit/1ed4e34)) 143 | * **resolver-pixi:** using data-type for resolver pixi images ([4f8a270](https://github.com/Igmat/baset/commit/4f8a270)) 144 | 145 | 146 | ### Features 147 | 148 | * **resolver-pixi:** initial implementation for pixi resolver ([dd82794](https://github.com/Igmat/baset/commit/dd82794)) 149 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-resolver-pixi/badge.svg)](https://snyk.io/test/npm/baset-resolver-pixi) 2 | 3 | # BaseT React resolver 4 | > Pixi resolver for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | - [Installation and usage](#installation-and-usage) 11 | 12 | 13 | 14 | ## Installation and usage 15 | Run: 16 | ``` 17 | npm install --save-dev baset-resolver-pixi 18 | ``` 19 | and adding next line to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 20 | ```JSON 21 | ".spec.js$": ["baset-resolver-pixi", "baset-baseliner-json"] 22 | ``` 23 | No additional options available for this plugin for now. 24 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-resolver-pixi", 3 | "version": "0.13.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "10.10.0", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.10.0.tgz", 10 | "integrity": "sha512-0V36JTaif20jrbTbZeKqnI4R8nLVE8Ah/u9dQT5jIKXjW51/4ipi/B8Xon1ZiEHATYpgLNoBw2LFfdBMoA5Fzg==", 11 | "dev": true 12 | }, 13 | "@types/pixi.js": { 14 | "version": "4.8.0", 15 | "resolved": "https://registry.npmjs.org/@types/pixi.js/-/pixi.js-4.8.0.tgz", 16 | "integrity": "sha512-XAnOxKMyJdb0OBaJUuu17kUzR2KWKLKrOPR7laPyPYbK7faGfQjt0ueYXdTlFVDdqXPBh653+ozO0LKdLWPD3Q==", 17 | "dev": true 18 | }, 19 | "bit-twiddle": { 20 | "version": "1.0.2", 21 | "resolved": "https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.2.tgz", 22 | "integrity": "sha1-DGwfq+KyPRcXPZpht7cJPrnhdp4=" 23 | }, 24 | "earcut": { 25 | "version": "2.1.3", 26 | "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.1.3.tgz", 27 | "integrity": "sha512-AxdCdWUk1zzK/NuZ7e1ljj6IGC+VAdC3Qb7QQDsXpfNrc5IM8tL9nNXUmEGE6jRHTfZ10zhzRhtDmWVsR5pd3A==" 28 | }, 29 | "eventemitter3": { 30 | "version": "2.0.3", 31 | "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", 32 | "integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=" 33 | }, 34 | "ismobilejs": { 35 | "version": "0.4.1", 36 | "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-0.4.1.tgz", 37 | "integrity": "sha1-Gl8SbHD+05yT2jgPpiy65XI+fcI=" 38 | }, 39 | "mini-signals": { 40 | "version": "1.2.0", 41 | "resolved": "https://registry.npmjs.org/mini-signals/-/mini-signals-1.2.0.tgz", 42 | "integrity": "sha1-RbCAE8X65RokqhqTXNMXye1yHXQ=" 43 | }, 44 | "object-assign": { 45 | "version": "4.1.1", 46 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 47 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 48 | }, 49 | "parse-uri": { 50 | "version": "1.0.0", 51 | "resolved": "https://registry.npmjs.org/parse-uri/-/parse-uri-1.0.0.tgz", 52 | "integrity": "sha1-KHLcwi8aeXrN4Vg9igrClVLdrCA=" 53 | }, 54 | "pixi-gl-core": { 55 | "version": "1.1.4", 56 | "resolved": "https://registry.npmjs.org/pixi-gl-core/-/pixi-gl-core-1.1.4.tgz", 57 | "integrity": "sha1-i0tcQzsx5Bm8N53FZc4bg1qRs3I=" 58 | }, 59 | "pixi.js": { 60 | "version": "4.8.2", 61 | "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-4.8.2.tgz", 62 | "integrity": "sha512-OHA3Q3wwxRJXkVWALVuiUcUqQZd5p0rQF9ikCvOmux3A6Lxb5S61v4PMEAVgR3+1auZekbv/GNHCxDGFCQSi8g==", 63 | "requires": { 64 | "bit-twiddle": "^1.0.2", 65 | "earcut": "^2.1.3", 66 | "eventemitter3": "^2.0.0", 67 | "ismobilejs": "^0.4.0", 68 | "object-assign": "^4.0.1", 69 | "pixi-gl-core": "^1.1.4", 70 | "remove-array-items": "^1.0.0", 71 | "resource-loader": "^2.1.1" 72 | } 73 | }, 74 | "remove-array-items": { 75 | "version": "1.0.0", 76 | "resolved": "https://registry.npmjs.org/remove-array-items/-/remove-array-items-1.0.0.tgz", 77 | "integrity": "sha1-B79CyzMvTPboXq2DteToltIyayE=" 78 | }, 79 | "resource-loader": { 80 | "version": "2.1.1", 81 | "resolved": "https://registry.npmjs.org/resource-loader/-/resource-loader-2.1.1.tgz", 82 | "integrity": "sha512-jRMGYUfa4AGk9ib45Wxc93lobhQVoiCUAUkWqsbb/fhGPge97YT1S8aC0xBEQpolMsrdmB3o7SH8VmIEvIDOLA==", 83 | "requires": { 84 | "mini-signals": "^1.1.1", 85 | "parse-uri": "^1.0.0" 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-resolver-pixi", 3 | "version": "0.14.7", 4 | "description": "Pixi resolver plugin for BaseT project.", 5 | "keywords": [ 6 | "baset-resolver-pixi", 7 | "pixi", 8 | "pixi.js", 9 | "baseline", 10 | "unit-test", 11 | "test", 12 | "testing", 13 | "e2e-test" 14 | ], 15 | "author": "Ihor Chulinda ", 16 | "license": "MIT", 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:Igmat/baset.git" 20 | }, 21 | "main": "dist/index.js", 22 | "types": "dist/index.d.ts", 23 | "scripts": { 24 | "build": "npm run tslint && tsc", 25 | "watch": "npm run tslint && tsc -w", 26 | "tslint": "tslint -c tslint.json -p tsconfig.json", 27 | "test": "baset", 28 | "accept": "baset accept", 29 | "doctoc": "doctoc README.md", 30 | "prepublish": "npm run doctoc" 31 | }, 32 | "devDependencies": { 33 | "@types/node": "^10.10.0", 34 | "@types/pixi.js": "^4.8.0" 35 | }, 36 | "dependencies": { 37 | "baset-core": "^0.14.7", 38 | "baset-vm": "^0.14.4", 39 | "pixi.js": "^4.8.4" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractResolver, dataTypes, utils } from 'baset-core'; 2 | import { NodeVM } from 'baset-vm'; 3 | import fs from 'fs'; 4 | import path from 'path'; 5 | import { Writable } from 'stream'; 6 | import { promisify } from 'util'; 7 | 8 | const readFile = promisify(fs.readFile); 9 | const renderInContextScript = readFile(path.resolve(__dirname, 'renderInContext.js'), { encoding: 'utf8' }); 10 | const matchInContextScript = readFile(path.resolve(__dirname, 'matchInContext.js'), { encoding: 'utf8' }); 11 | 12 | export default class PixiResolver extends AbstractResolver { 13 | match = async (obj: any, context: NodeVM, sandbox: utils.IDictionary) => { 14 | sandbox.basetResolverPixi__ObjectToMatch = obj; 15 | 16 | return context.run<{matchResult: boolean}>(await matchInContextScript, 'PixiResolver.js').matchResult; 17 | } 18 | resolve = async (obj: any, context: NodeVM, sandbox: utils.IDictionary) => { 19 | sandbox.basetResolverPixi__ObjectToRender = obj; 20 | const base64String = await context.run<{ renderedResult: string }>(await renderInContextScript, 'PixiResolver.js').renderedResult; 21 | 22 | return { 23 | value: base64String, 24 | [dataTypes.image]: 'base64', 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/src/matchInContext.ts: -------------------------------------------------------------------------------- 1 | import 'pixi.js'; 2 | declare const basetSandbox: { basetResolverPixi__ObjectToMatch: unknown }; 3 | 4 | export const matchResult = basetSandbox.basetResolverPixi__ObjectToMatch instanceof PIXI.DisplayObject; 5 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/src/renderInContext.ts: -------------------------------------------------------------------------------- 1 | import 'pixi.js'; 2 | declare const basetSandbox: { basetResolverPixi__ObjectToRender: PIXI.DisplayObject }; 3 | 4 | const objectToRender = basetSandbox.basetResolverPixi__ObjectToRender; 5 | const bounds = objectToRender.getBounds(); 6 | const app = new PIXI.Application(bounds.width, bounds.height); 7 | const canvas = document.body.appendChild(app.view); 8 | 9 | app.stage.addChild(objectToRender); 10 | app.render(); 11 | 12 | export const renderedResult = new Promise((resolve, reject) => 13 | app.ticker.addOnce(() => 14 | resolve(canvas.toDataURL('image/png')))); 15 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-resolver-pixi/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 8 | 9 | **Note:** Version bump only for package baset-resolver-react 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 17 | 18 | **Note:** Version bump only for package baset-resolver-react 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 26 | 27 | **Note:** Version bump only for package baset-resolver-react 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 35 | 36 | **Note:** Version bump only for package baset-resolver-react 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 44 | 45 | **Note:** Version bump only for package baset-resolver-react 46 | 47 | 48 | 49 | 50 | 51 | 52 | # [0.14.0](https://github.com/Igmat/baset/compare/v0.13.7...v0.14.0) (2018-09-04) 53 | 54 | 55 | ### Features 56 | 57 | * **resolver-react:** using react-test-render instead of react-dom ([1703b43](https://github.com/Igmat/baset/commit/1703b43)) 58 | 59 | 60 | 61 | 62 | 63 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 64 | 65 | 66 | 67 | 68 | **Note:** Version bump only for package baset-resolver-react 69 | 70 | 71 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 72 | 73 | 74 | 75 | 76 | **Note:** Version bump only for package baset-resolver-react 77 | 78 | 79 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 80 | 81 | 82 | 83 | 84 | **Note:** Version bump only for package baset-resolver-react 85 | 86 | 87 | ## [0.13.3](https://github.com/Igmat/baset/compare/v0.13.2...v0.13.3) (2018-06-08) 88 | 89 | 90 | 91 | 92 | **Note:** Version bump only for package baset-resolver-react 93 | 94 | 95 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 96 | 97 | 98 | 99 | 100 | **Note:** Version bump only for package baset-resolver-react 101 | 102 | 103 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 104 | 105 | 106 | 107 | 108 | **Note:** Version bump only for package baset-resolver-react 109 | 110 | 111 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 112 | 113 | 114 | 115 | 116 | **Note:** Version bump only for package baset-resolver-react 117 | 118 | 119 | ## [0.11.1](https://github.com/Igmat/baset/compare/v0.11.0...v0.11.1) (2018-03-15) 120 | 121 | 122 | 123 | 124 | **Note:** Version bump only for package baset-resolver-react 125 | 126 | 127 | # [0.11.0](https://github.com/Igmat/baset/compare/v0.10.0...v0.11.0) (2018-03-08) 128 | 129 | 130 | 131 | 132 | **Note:** Version bump only for package baset-resolver-react 133 | 134 | 135 | # [0.10.0](https://github.com/Igmat/baset/compare/v0.9.1...v0.10.0) (2018-03-07) 136 | 137 | 138 | 139 | 140 | **Note:** Version bump only for package baset-resolver-react 141 | 142 | 143 | # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) 144 | 145 | 146 | ### Bug Fixes 147 | 148 | * **resolver-react:** using html data type for beautified baseline ([36369eb](https://github.com/Igmat/baset/commit/36369eb)) 149 | 150 | 151 | ### Features 152 | 153 | * **resolver-react:** initial implementation for react resolver ([43aea7a](https://github.com/Igmat/baset/commit/43aea7a)) 154 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-resolver-react/badge.svg)](https://snyk.io/test/npm/baset-resolver-react) 2 | 3 | # BaseT React resolver 4 | > React resolver for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | 7 | 8 | 9 | 10 | - [Installation and usage](#installation-and-usage) 11 | 12 | 13 | 14 | ## Installation and usage 15 | Run: 16 | ``` 17 | npm install --save-dev baset-resolver-react 18 | ``` 19 | and adding next line to `baset.plugins` section in your `package.json` or `plugins` section in your `.basetrc`/`.basetrc.json`: 20 | ```JSON 21 | ".spec.js$": ["baset-resolver-react", "baset-baseliner-json"] 22 | ``` 23 | No additional options available for this plugin for now. 24 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-resolver-react", 3 | "version": "0.14.7", 4 | "description": "React resolver plugin for BaseT project.", 5 | "keywords": [ 6 | "baset-resolver-react", 7 | "react", 8 | "baseline", 9 | "unit-test", 10 | "test", 11 | "testing", 12 | "e2e-test" 13 | ], 14 | "author": "Ihor Chulinda ", 15 | "license": "MIT", 16 | "repository": { 17 | "type": "git", 18 | "url": "git@github.com:Igmat/baset.git" 19 | }, 20 | "main": "dist/index.js", 21 | "types": "dist/index.d.ts", 22 | "scripts": { 23 | "build": "npm run tslint && tsc", 24 | "watch": "npm run tslint && tsc -w", 25 | "tslint": "tslint -c tslint.json -p tsconfig.json", 26 | "test": "baset", 27 | "accept": "baset accept", 28 | "doctoc": "doctoc README.md", 29 | "prepublish": "npm run doctoc" 30 | }, 31 | "devDependencies": { 32 | "@types/node": "^10.10.0", 33 | "@types/pretty-format": "^20.0.0", 34 | "@types/react": "^16.4.14", 35 | "@types/react-test-renderer": "^16.0.2" 36 | }, 37 | "dependencies": { 38 | "baset-core": "^0.14.7", 39 | "pretty-format": "^23.6.0", 40 | "react": "^16.5.1", 41 | "react-test-renderer": "^16.5.1" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/src/index.ts: -------------------------------------------------------------------------------- 1 | import { AbstractResolver, dataTypes } from 'baset-core'; 2 | import prettyFormat from 'pretty-format'; 3 | import React, { ReactElement } from 'react'; 4 | import ReactTestRenderer from 'react-test-renderer'; 5 | const { ReactElement, ReactTestComponent } = prettyFormat.plugins; 6 | 7 | export default class ReactResolver extends AbstractResolver { 8 | match = async (obj: {} | null | undefined) => 9 | React.isValidElement(obj); 10 | resolve = async (obj: ReactElement) => ({ 11 | value: prettyFormat(ReactTestRenderer.create(obj).toJSON(), { 12 | plugins: [ReactTestComponent], 13 | printFunctionName: false, 14 | }), 15 | [dataTypes.html]: 'react', 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-resolver-react/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset-vm/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | tsconfig.json 5 | tslint.json 6 | -------------------------------------------------------------------------------- /packages/baset-vm/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 8 | 9 | 10 | ### Bug Fixes 11 | 12 | * **vm:** implement mocks as reference to filename ([d58576a](https://github.com/Igmat/baset/commit/d58576a)) 13 | 14 | 15 | 16 | 17 | 18 | 19 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 20 | 21 | 22 | ### Bug Fixes 23 | 24 | * **vm:** change file path to be consistent with os ([27dfba4](https://github.com/Igmat/baset/commit/27dfba4)) 25 | 26 | 27 | 28 | 29 | 30 | 31 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 32 | 33 | **Note:** Version bump only for package baset-vm 34 | 35 | 36 | 37 | 38 | 39 | 40 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 41 | 42 | 43 | ### Bug Fixes 44 | 45 | * **vm:** correct global for vm without broken function constructor ([1405c53](https://github.com/Igmat/baset/commit/1405c53)), closes [#58](https://github.com/Igmat/baset/issues/58) 46 | 47 | 48 | 49 | 50 | 51 | # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) 52 | 53 | 54 | ### Bug Fixes 55 | 56 | * **vm:** more correct proxy for sandboxed object ([b31a8de](https://github.com/Igmat/baset/commit/b31a8de)) 57 | 58 | 59 | 60 | 61 | 62 | ## [0.7.3](https://github.com/Igmat/baset/compare/v0.7.2...v0.7.3) (2018-02-13) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * **vm:** check if path found like file is directory ([950bd57](https://github.com/Igmat/baset/commit/950bd57)) 68 | 69 | 70 | 71 | 72 | 73 | ## [0.7.2](https://github.com/Igmat/baset/compare/v0.7.1...v0.7.2) (2018-02-12) 74 | 75 | 76 | ### Bug Fixes 77 | 78 | * **vm:** allow usage of native modules in vm ([5d17b49](https://github.com/Igmat/baset/commit/5d17b49)) 79 | 80 | 81 | 82 | 83 | 84 | # [0.6.0](https://github.com/Igmat/baset/compare/v0.5.1...v0.6.0) (2018-02-08) 85 | 86 | 87 | ### Bug Fixes 88 | 89 | * **vm:** adding missing chdir to vm process ([32babe4](https://github.com/Igmat/baset/commit/32babe4)) 90 | * **vm:** adding missing process-uptime function ([fd66e73](https://github.com/Igmat/baset/commit/fd66e73)) 91 | * **vm:** removing readonly contextifying in order to support e2e ([11bbd17](https://github.com/Igmat/baset/commit/11bbd17)) 92 | 93 | 94 | ### Features 95 | 96 | * **vm:** add baset-vm package (forked from vm2) ([0d6046b](https://github.com/Igmat/baset/commit/0d6046b)) 97 | -------------------------------------------------------------------------------- /packages/baset-vm/README.md: -------------------------------------------------------------------------------- 1 | [![Known Vulnerabilities](https://snyk.io/test/npm/baset-vm/badge.svg)](https://snyk.io/test/npm/baset-vm) 2 | 3 | # BaseT VM 4 | > VM for [BaseT](https://github.com/Igmat/baset) project. 5 | 6 | > **DISCLAIMER**: it was a fork of [vm2](https://github.com/patriksimek/vm2) package for internal use in baset with some functionality that is missing in original project. 7 | 8 | > After major overwrite of this module - it's only responsibility is running code in separate `node.js` context within same proccess, so host isn't required to serialize/deserialize data from it's children. But unlike original `vm2` package it's not designed for running untrusted code - normal code won't affect host's environment in most cases but there are **NO PROGRAM RESTRICTIONS** to do it, so if you know how this context is built and which parts are actually shared between host and child you are able to affect host from child. Such decision is made, because securing host makes vm much slower, which is ok for running untrusted code, but huge overkill for running tests. 9 | 10 | > If, for some reason, you're interested in `vm2` replacement (as I was). Create an issue in this repo - and I'll do my best to make this package `production-ready`. 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/baset-vm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset-vm", 3 | "version": "0.14.4", 4 | "description": "VM package for BaseT project.", 5 | "keywords": [ 6 | "baset-vm", 7 | "vm", 8 | "vm2", 9 | "baseline", 10 | "unit-test", 11 | "test", 12 | "testing", 13 | "e2e-test" 14 | ], 15 | "author": "Ihor Chulinda ", 16 | "license": "MIT", 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:Igmat/baset.git" 20 | }, 21 | "main": "dist/index.js", 22 | "types": "dist/index.d.ts", 23 | "engines": { 24 | "node": ">=6.0" 25 | }, 26 | "scripts": { 27 | "build": "npm run tslint && tsc", 28 | "watch": "npm run tslint && tsc -w", 29 | "tslint": "tslint -c tslint.json -p tsconfig.json", 30 | "test": "baset", 31 | "accept": "baset accept", 32 | "doctoc": "doctoc README.md", 33 | "prepublish": "npm run doctoc" 34 | }, 35 | "devDependencies": { 36 | "@types/node": "^10.10.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/baset-vm/src/VMError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * VMError. 3 | * 4 | * @class 5 | * @extends {Error} 6 | * @property {String} stack Call stack. 7 | * @property {String} message Error message. 8 | */ 9 | export class VMError extends Error { 10 | constructor(message: string, public code?: string) { 11 | super(message); 12 | this.name = 'VMError'; 13 | Error.captureStackTrace(this, this.constructor); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/baset-vm/src/VMScript.ts: -------------------------------------------------------------------------------- 1 | import vm from 'vm'; 2 | 3 | export class VMScript { 4 | private wrapped = false; 5 | private compiled?: vm.Script; 6 | constructor(private code: string, public filename = 'vm.js') { 7 | } 8 | wrap(prefix: string, postfix: string) { 9 | if (this.wrapped) { 10 | return this; 11 | } 12 | this.code = prefix + this.code + postfix; 13 | this.wrapped = true; 14 | 15 | return this; 16 | } 17 | compile() { 18 | if (this.compiled) { 19 | return this.compiled; 20 | } 21 | const compiled = new vm.Script(this.code, { 22 | filename: this.filename, 23 | displayErrors: false, 24 | }); 25 | this.compiled = compiled; 26 | 27 | return compiled; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/baset-vm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": ".", 6 | "paths": { 7 | "*": [ 8 | "node_modules/*", 9 | "src/types/*" 10 | ] 11 | } 12 | }, 13 | "include": [ 14 | "src/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/baset-vm/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../../tslint.json" 4 | ], 5 | "rules": { 6 | "no-default-export": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/baset/.gitignore: -------------------------------------------------------------------------------- 1 | # RADME in this folder is copied from root, so we don't need to add it to SVC 2 | README.md 3 | -------------------------------------------------------------------------------- /packages/baset/.npmignore: -------------------------------------------------------------------------------- 1 | !/bin/**/* 2 | !/dist/**/* 3 | /src/ 4 | /scripts/ 5 | tsconfig.json 6 | tslint.json 7 | -------------------------------------------------------------------------------- /packages/baset/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ihor Chulinda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/baset/bin/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const { cli } = require('baset-cli'); 3 | cli.argv; 4 | -------------------------------------------------------------------------------- /packages/baset/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset", 3 | "version": "0.13.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "10.10.0", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.10.0.tgz", 10 | "integrity": "sha512-0V36JTaif20jrbTbZeKqnI4R8nLVE8Ah/u9dQT5jIKXjW51/4ipi/B8Xon1ZiEHATYpgLNoBw2LFfdBMoA5Fzg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/baset/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "baset", 3 | "version": "0.14.8", 4 | "description": "Tool for testing using baseline strategy.", 5 | "keywords": [ 6 | "baset", 7 | "cli", 8 | "baseline", 9 | "unit-test", 10 | "test", 11 | "testing", 12 | "e2e-test" 13 | ], 14 | "author": "Ihor Chulinda ", 15 | "license": "MIT", 16 | "repository": { 17 | "type": "git", 18 | "url": "git@github.com:Igmat/baset.git" 19 | }, 20 | "bin": { 21 | "baset": "./bin/index.js" 22 | }, 23 | "scripts": { 24 | "prepublish": "node ./scripts/prepublish.js" 25 | }, 26 | "dependencies": { 27 | "baset-baseliner-json": "^0.14.8", 28 | "baset-cli": "^0.14.7" 29 | }, 30 | "devDependencies": { 31 | "@types/node": "^10.10.0" 32 | }, 33 | "yargs": { 34 | "dot-notation": false 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/baset/scripts/prepublish.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs'); 3 | 4 | const rootReadme = path.resolve(__dirname, './../../../README.md'); 5 | const currentReadme = path.resolve(__dirname, './../README.md'); 6 | fs.writeFileSync(currentReadme, fs.readFileSync(rootReadme)); 7 | -------------------------------------------------------------------------------- /scripts/createBinSymlinks.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const utils = require('util'); 4 | const resolve = require('@lerna/resolve-symlink'); 5 | const symlink = require('@lerna/create-symlink'); 6 | 7 | const ls = utils.promisify(fs.readdir); 8 | const lstat = utils.promisify(fs.lstat); 9 | async function isExists(filename) { 10 | try { 11 | const stats = await lstat(filename); 12 | return stats.isSymbolicLink() || stats.isFile(); 13 | } catch (err) { 14 | return false; 15 | } 16 | } 17 | 18 | const binFolder = './node_modules/.bin/'; 19 | const packagesFolder = './packages'; 20 | 21 | async function createBinSymlinks() { 22 | const binaries = (await ls(binFolder)) 23 | .filter(binary => !/\.cmd$/.test(binary)) 24 | .map(binary => ({ 25 | name: binary, 26 | path: path.resolve(binFolder, binary) 27 | })); 28 | const packages = (await ls(packagesFolder)) 29 | .map(package => path.resolve(packagesFolder, package)) 30 | .filter(package => fs.statSync(package).isDirectory()); 31 | return Promise.all(packages.map(package => 32 | Promise.all(binaries.map(async (binary) => { 33 | const symlinkPath = path.resolve(package, binFolder, binary.name); 34 | if (await isExists(symlinkPath)) return; 35 | return symlink(resolve(binary.path), symlinkPath, 'exec'); 36 | })))); 37 | } 38 | 39 | createBinSymlinks(); 40 | -------------------------------------------------------------------------------- /tests/accept.spec.ts: -------------------------------------------------------------------------------- 1 | import { sync as spawnSync } from 'cross-spawn'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | export = fs.readdirSync(__dirname) 6 | .filter(source => fs.lstatSync(path.join(__dirname, source)).isDirectory()) 7 | .filter(project => project !== 'scaffolded-project') 8 | .map(project => { 9 | const cwd = path.resolve(__dirname, `./${project}`); 10 | const testProccess = spawnSync('npm', ['test'], { cwd, encoding: 'utf8' }); 11 | const acceptProccess = spawnSync('npm', ['run', 'accept'], { cwd, encoding: 'utf8' }); 12 | 13 | return { 14 | project, 15 | test: { 16 | stdout: testProccess.stdout.split('\n') 17 | // we don't need to check npm tasks output (like `> baset` or `> path/to/node.exe index.js`) 18 | .filter(line => !line.startsWith('>')) 19 | .filter(line => !line.startsWith('PixiJS')) 20 | .map(line => line 21 | .replace(/\(.*m?s\)/, '') // we don't need timing output from `tap-diff` here 22 | .replace(/(✔|√)/, ' ')), // `tap-diff` has different signs on win and *nix 23 | stderr: testProccess.stderr.split('\n') 24 | // we don't need to check npm warn about node version used in script 25 | .filter(line => !line.search('`--scripts-prepend-node-path`')), 26 | }, 27 | accept: { 28 | stdout: acceptProccess.stdout.split('\n') 29 | // we don't need to check npm tasks output (like `> baset` or `> path/to/node.exe index.js`) 30 | .filter(line => !line.startsWith('>')) 31 | .filter(line => !line.startsWith('PixiJS')) 32 | .map(line => line 33 | .replace(/\(.*m?s\)/, '') // we don't need timing output from `tap-diff` here 34 | .replace(/(✔|√)/, ' ')), // `tap-diff` has different signs on win and *nix 35 | stderr: acceptProccess.stderr.split('\n') 36 | // we don't need to check npm warn about node version used in script 37 | .filter(line => !line.search('`--scripts-prepend-node-path`')), 38 | }, 39 | }; 40 | }); 41 | -------------------------------------------------------------------------------- /tests/babel-project/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tests/babel-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.jsx", 3 | "bases": "**/*.spec.base.md", 4 | "plugins": { 5 | ".spec.jsx?$": { 6 | "readers": ["baset-reader-babel"], 7 | "resolvers": "baset-resolver-react", 8 | "baseliner": "baset-baseliner-md" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/babel-project/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export const jsxFn = (a, b) => (
{a + b}
); 4 | -------------------------------------------------------------------------------- /tests/babel-project/index.spec.base.md: -------------------------------------------------------------------------------- 1 | `exports.default.value1:` 2 | 3 | ```HTML 4 |
7 | 2 8 |
9 | ``` 10 | 11 | 12 | `exports.default.value2:` 13 | 14 | ```HTML 15 |
18 | qq 19 |
20 | ``` 21 | 22 | 23 | `exports.value:` 24 | 25 | ```HTML 26 |
27 |
30 | ss 31 |
32 |
35 | abccba 36 |
37 |
40 | sabc 41 |
42 |
45 | abcs 46 |
47 |
48 | ``` -------------------------------------------------------------------------------- /tests/babel-project/index.spec.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { jsxFn } from './index'; 3 | 4 | export const value = ( 5 |
6 | {jsxFn('s', 's')} 7 | {jsxFn('abc', 'cba')} 8 | {jsxFn('s', 'abc')} 9 | {jsxFn('abc', 's')} 10 |
11 | ); 12 | 13 | export default { 14 | 'value1': jsxFn(1, 1), 15 | 'value2': jsxFn('q', 'q'), 16 | }; 17 | -------------------------------------------------------------------------------- /tests/babel-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "react": "^16.5.1", 15 | "react-dom": "^16.5.1" 16 | }, 17 | "devDependencies": { 18 | "babel-cli": "^6.26.0", 19 | "babel-preset-es2015": "^6.24.1", 20 | "babel-preset-react": "^6.24.1", 21 | "baset": "^0.14.8", 22 | "baset-baseliner-md": "^0.14.8", 23 | "baset-env-browser": "^0.14.7", 24 | "baset-reader-babel": "^0.14.7", 25 | "baset-resolver-react": "^0.14.7" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/canvas-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts", 3 | "bases": "**/*.spec.base.md", 4 | "plugins": { 5 | ".spec.ts$": { 6 | "environment": "baset-env-browser", 7 | "readers": "baset-reader-ts", 8 | "resolvers": "baset-resolver-pixi", 9 | "baseliner": "baset-baseliner-md" 10 | } 11 | }, 12 | "options": { 13 | "baset-env-browser": { 14 | "serverPort": 3000 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/canvas-project/assets/abstract-baset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/tests/canvas-project/assets/abstract-baset.jpg -------------------------------------------------------------------------------- /tests/canvas-project/assets/assets.json: -------------------------------------------------------------------------------- 1 | {"frames": { 2 | 3 | "Light_green": 4 | { 5 | "frame": {"x":4,"y":132,"w":108,"h":108}, 6 | "rotated": false, 7 | "trimmed": false, 8 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 9 | "sourceSize": {"w":108,"h":105} 10 | }, 11 | "Light_orange": 12 | { 13 | "frame": {"x":4,"y":244,"w":108,"h":108}, 14 | "rotated": false, 15 | "trimmed": false, 16 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 17 | "sourceSize": {"w":108,"h":105} 18 | }, 19 | "Light_red": 20 | { 21 | "frame": {"x":4,"y":356,"w":108,"h":108}, 22 | "rotated": false, 23 | "trimmed": false, 24 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 25 | "sourceSize": {"w":108,"h":105} 26 | }, 27 | "Light_yellow": 28 | { 29 | "frame": {"x":116,"y":132,"w":108,"h":108}, 30 | "rotated": false, 31 | "trimmed": false, 32 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 33 | "sourceSize": {"w":108,"h":105} 34 | }, 35 | "Point_green": 36 | { 37 | "frame": {"x":4,"y":468,"w":20,"h":20}, 38 | "rotated": false, 39 | "trimmed": false, 40 | "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, 41 | "sourceSize": {"w":20,"h":20} 42 | }, 43 | "Point_orange": 44 | { 45 | "frame": {"x":28,"y":468,"w":20,"h":20}, 46 | "rotated": false, 47 | "trimmed": false, 48 | "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, 49 | "sourceSize": {"w":20,"h":20} 50 | }, 51 | "Point_red": 52 | { 53 | "frame": {"x":52,"y":468,"w":20,"h":20}, 54 | "rotated": false, 55 | "trimmed": false, 56 | "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, 57 | "sourceSize": {"w":20,"h":20} 58 | }, 59 | "Point_yellow": 60 | { 61 | "frame": {"x":76,"y":468,"w":20,"h":20}, 62 | "rotated": false, 63 | "trimmed": false, 64 | "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, 65 | "sourceSize": {"w":20,"h":20} 66 | }, 67 | "Radar_circle": 68 | { 69 | "frame": {"x":4,"y":4,"w":124,"h":124}, 70 | "rotated": false, 71 | "trimmed": false, 72 | "spriteSourceSize": {"x":0,"y":0,"w":124,"h":124}, 73 | "sourceSize": {"w":122,"h":122} 74 | }, 75 | "Radar_monitor_green": 76 | { 77 | "frame": {"x":132,"y":4,"w":108,"h":108}, 78 | "rotated": false, 79 | "trimmed": false, 80 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 81 | "sourceSize": {"w":108,"h":108} 82 | }, 83 | "Radar_monitor_orange": 84 | { 85 | "frame": {"x":116,"y":244,"w":108,"h":108}, 86 | "rotated": false, 87 | "trimmed": false, 88 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 89 | "sourceSize": {"w":108,"h":108} 90 | }, 91 | "Radar_monitor_red": 92 | { 93 | "frame": {"x":116,"y":356,"w":108,"h":108}, 94 | "rotated": false, 95 | "trimmed": false, 96 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 97 | "sourceSize": {"w":108,"h":108} 98 | }, 99 | "Radar_monitor_red_glow": 100 | { 101 | "frame": {"x":244,"y":4,"w":108,"h":108}, 102 | "rotated": false, 103 | "trimmed": false, 104 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 105 | "sourceSize": {"w":108,"h":108} 106 | }, 107 | "Radar_monitor_yellow": 108 | { 109 | "frame": {"x":356,"y":4,"w":108,"h":108}, 110 | "rotated": false, 111 | "trimmed": false, 112 | "spriteSourceSize": {"x":0,"y":0,"w":108,"h":108}, 113 | "sourceSize": {"w":108,"h":108} 114 | }}, 115 | "meta": { 116 | "app": "http://www.codeandweb.com/texturepacker", 117 | "version": "1.0", 118 | "image": "assets.png", 119 | "format": "RGBA8888", 120 | "size": {"w":512,"h":512}, 121 | "scale": "1", 122 | "smartupdate": "$TexturePacker:SmartUpdate:a77bec91ef728b89ff42870105b598ed:e821754604ff56291107fc37d344d6df:54f404a1f943b3ebab0b1705c0120670$" 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /tests/canvas-project/assets/assets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/tests/canvas-project/assets/assets.png -------------------------------------------------------------------------------- /tests/canvas-project/graphics.spec.ts: -------------------------------------------------------------------------------- 1 | export * from './graphics'; 2 | -------------------------------------------------------------------------------- /tests/canvas-project/graphics.ts: -------------------------------------------------------------------------------- 1 | import 'pixi.js'; 2 | export const graphics = new PIXI.Graphics(); 3 | // set a fill and line style 4 | graphics.beginFill(0xFF3300); 5 | graphics.lineStyle(4, 0xFFD900, 1); 6 | 7 | // draw a shape 8 | graphics.moveTo(50, 50); 9 | graphics.lineTo(250, 50); 10 | graphics.lineTo(100, 100); 11 | graphics.lineTo(50, 50); 12 | graphics.endFill(); 13 | 14 | // set a fill and a line style again and draw a rectangle 15 | graphics.lineStyle(2, 0x0000FF, 1); 16 | graphics.beginFill(0xFF700B, 1); 17 | graphics.drawRect(50, 250, 120, 120); 18 | 19 | // draw a rounded rectangle 20 | graphics.lineStyle(2, 0xFF00FF, 1); 21 | graphics.beginFill(0xFF00BB, 0.25); 22 | graphics.drawRoundedRect(150, 450, 300, 100, 15); 23 | graphics.endFill(); 24 | 25 | // draw a circle, set the lineStyle to zero so the circle doesn't have an outline 26 | graphics.lineStyle(0); 27 | graphics.beginFill(0xFFFF0B, 0.5); 28 | graphics.drawCircle(470, 90, 60); 29 | graphics.endFill(); 30 | -------------------------------------------------------------------------------- /tests/canvas-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "canvas-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/canvas-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "canvas-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "pixi.js": "^4.8.4" 15 | }, 16 | "devDependencies": { 17 | "@types/pixi.js": "^4.8.0", 18 | "baset": "^0.14.8", 19 | "baset-baseliner-md": "^0.14.8", 20 | "baset-env-browser": "^0.14.7", 21 | "baset-reader-ts": "^0.14.7", 22 | "baset-resolver-pixi": "^0.14.7", 23 | "typescript": "^3.0.3" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/canvas-project/sprite.spec.ts: -------------------------------------------------------------------------------- 1 | export * from './sprite'; 2 | -------------------------------------------------------------------------------- /tests/canvas-project/sprite.ts: -------------------------------------------------------------------------------- 1 | import 'pixi.js'; 2 | interface IResourceDictionary { 3 | [index: string]: PIXI.loaders.Resource; 4 | } 5 | 6 | const ASSETS = './assets/assets.json'; 7 | const RADAR_GREEN = 'Light_green'; 8 | 9 | const getSprite = async () => { 10 | await new Promise(resolve => PIXI.loader 11 | .add(ASSETS) 12 | .load(resolve)); 13 | 14 | return new PIXI.Sprite(PIXI.utils.TextureCache[RADAR_GREEN]); 15 | }; 16 | 17 | export const sprite = getSprite(); 18 | -------------------------------------------------------------------------------- /tests/canvas-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*", 20 | "lib/*" 21 | ] 22 | }, 23 | "experimentalDecorators": true, 24 | "emitDecoratorMetadata": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/circular-reference-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts", 3 | "bases": "**/*.base", 4 | "plugins": { 5 | ".spec.js$": "baset-baseliner-json", 6 | ".spec.ts$": ["baset-reader-ts", "baset-baseliner-json"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/circular-reference-project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.8](https://github.com/Igmat/baset/compare/v0.14.7...v0.14.8) (2018-10-10) 8 | 9 | **Note:** Version bump only for package circular-reference-project 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 17 | 18 | **Note:** Version bump only for package circular-reference-project 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 26 | 27 | **Note:** Version bump only for package circular-reference-project 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.5](https://github.com/Igmat/baset/compare/v0.14.4...v0.14.5) (2018-10-09) 35 | 36 | **Note:** Version bump only for package circular-reference-project 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 44 | 45 | **Note:** Version bump only for package circular-reference-project 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 53 | 54 | **Note:** Version bump only for package circular-reference-project 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 62 | 63 | **Note:** Version bump only for package circular-reference-project 64 | 65 | 66 | 67 | 68 | 69 | 70 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 71 | 72 | 73 | 74 | 75 | **Note:** Version bump only for package circular-reference-project 76 | 77 | 78 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 79 | 80 | 81 | 82 | 83 | **Note:** Version bump only for package circular-reference-project 84 | 85 | 86 | ## [0.13.5](https://github.com/Igmat/baset/compare/v0.13.4...v0.13.5) (2018-06-08) 87 | 88 | 89 | 90 | 91 | **Note:** Version bump only for package circular-reference-project 92 | 93 | 94 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 95 | 96 | 97 | 98 | 99 | **Note:** Version bump only for package circular-reference-project 100 | 101 | 102 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 103 | 104 | 105 | 106 | 107 | **Note:** Version bump only for package circular-reference-project 108 | 109 | 110 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 111 | 112 | 113 | 114 | 115 | **Note:** Version bump only for package circular-reference-project 116 | 117 | 118 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 119 | 120 | 121 | 122 | 123 | **Note:** Version bump only for package circular-reference-project 124 | 125 | 126 | ## [0.11.1](https://github.com/Igmat/baset/compare/v0.11.0...v0.11.1) (2018-03-15) 127 | 128 | 129 | 130 | 131 | **Note:** Version bump only for package circular-reference-project 132 | 133 | 134 | # [0.11.0](https://github.com/Igmat/baset/compare/v0.10.0...v0.11.0) (2018-03-08) 135 | 136 | 137 | 138 | 139 | **Note:** Version bump only for package circular-reference-project 140 | 141 | 142 | # [0.10.0](https://github.com/Igmat/baset/compare/v0.9.1...v0.10.0) (2018-03-07) 143 | 144 | 145 | 146 | 147 | **Note:** Version bump only for package circular-reference-project 148 | 149 | 150 | # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) 151 | 152 | 153 | 154 | 155 | **Note:** Version bump only for package circular-reference-project 156 | 157 | 158 | # [0.8.0](https://github.com/Igmat/baset/compare/v0.7.5...v0.8.0) (2018-02-28) 159 | 160 | 161 | 162 | 163 | **Note:** Version bump only for package circular-reference-project 164 | 165 | 166 | ## [0.7.4](https://github.com/Igmat/baset/compare/v0.7.3...v0.7.4) (2018-02-26) 167 | 168 | 169 | 170 | 171 | **Note:** Version bump only for package circular-reference-project 172 | -------------------------------------------------------------------------------- /tests/circular-reference-project/index.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "sampleObj": { 3 | "a": { 4 | "deepCircularReference": exports.sampleObj 5 | }, 6 | "circularReference": exports.sampleObj, 7 | "b": { 8 | "a": exports.sampleObj.a 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /tests/circular-reference-project/index.spec.ts: -------------------------------------------------------------------------------- 1 | export { sampleObj } from './index'; 2 | -------------------------------------------------------------------------------- /tests/circular-reference-project/index.ts: -------------------------------------------------------------------------------- 1 | const sampleObj: { [index: string]: any } = { 2 | a: {}, 3 | }; 4 | sampleObj.circularReference = sampleObj; 5 | sampleObj.a.deepCircularReference = sampleObj; 6 | sampleObj.b = { 7 | a: sampleObj.a, 8 | }; 9 | 10 | export { 11 | sampleObj, 12 | }; 13 | -------------------------------------------------------------------------------- /tests/circular-reference-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "circular-reference-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/circular-reference-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "circular-reference-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "baset": "^0.14.8", 15 | "baset-baseliner-json": "^0.14.8", 16 | "baset-reader-ts": "^0.14.7", 17 | "typescript": "^3.0.3" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/circular-reference-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*", 20 | "lib/*" 21 | ] 22 | }, 23 | "experimentalDecorators": true, 24 | "emitDecoratorMetadata": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/dom-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.js", 3 | "bases": "**/*.base", 4 | "plugins": { 5 | ".spec.js$": ["baset-env-browser", "baset-baseliner-json"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/dom-project/index.js: -------------------------------------------------------------------------------- 1 | const body = document.getElementsByTagName('body')[0]; 2 | body.appendChild(document.createElement('div')); 3 | body.appendChild(document.createElement('div')); 4 | body.appendChild(document.createElement('div')); 5 | 6 | function sampleFn(a, b) { 7 | const divNumber = document.getElementsByTagName('div').length; 8 | return a + b * divNumber; 9 | } 10 | 11 | module.exports.sampleFn = sampleFn; 12 | -------------------------------------------------------------------------------- /tests/dom-project/index.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | 4, 4 | 4000000, 5 | "abcNaN", 6 | Infinity, 7 | "abc3", 8 | "function call3", 9 | "async value3" 10 | ] 11 | } -------------------------------------------------------------------------------- /tests/dom-project/index.spec.js: -------------------------------------------------------------------------------- 1 | const { sampleFn } = require('./index'); 2 | 3 | module.exports = { 4 | values: [ 5 | sampleFn(1, 1), 6 | sampleFn(1000000, 1000000), 7 | sampleFn('abc', 'cba'), 8 | sampleFn(1, 'abc'), 9 | sampleFn('abc', 1), 10 | () => sampleFn('function call', 1), 11 | new Promise(resolve => resolve(sampleFn('async value', 1))) 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tests/dom-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dom-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "baset": "^0.14.8", 15 | "baset-baseliner-json": "^0.14.8", 16 | "baset-env-browser": "^0.14.7" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/md-specs-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.md", 3 | "files": "**/*.ts", 4 | "bases": "**/*.base.md", 5 | "plugins": { 6 | ".spec.md$": { 7 | "readers": ["baset-reader-md", "baset-reader-ts"], 8 | "baseliner": "baset-baseliner-md" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/md-specs-project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.8](https://github.com/Igmat/baset/compare/v0.14.7...v0.14.8) (2018-10-10) 8 | 9 | **Note:** Version bump only for package md-specs-project 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 17 | 18 | **Note:** Version bump only for package md-specs-project 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 26 | 27 | **Note:** Version bump only for package md-specs-project 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.5](https://github.com/Igmat/baset/compare/v0.14.4...v0.14.5) (2018-10-09) 35 | 36 | **Note:** Version bump only for package md-specs-project 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 44 | 45 | **Note:** Version bump only for package md-specs-project 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 53 | 54 | **Note:** Version bump only for package md-specs-project 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 62 | 63 | **Note:** Version bump only for package md-specs-project 64 | 65 | 66 | 67 | 68 | 69 | 70 | # [0.14.0](https://github.com/Igmat/baset/compare/v0.13.7...v0.14.0) (2018-09-04) 71 | 72 | 73 | 74 | 75 | **Note:** Version bump only for package md-specs-project 76 | 77 | 78 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 79 | 80 | 81 | 82 | 83 | **Note:** Version bump only for package md-specs-project 84 | 85 | 86 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 87 | 88 | 89 | 90 | 91 | **Note:** Version bump only for package md-specs-project 92 | 93 | 94 | ## [0.13.5](https://github.com/Igmat/baset/compare/v0.13.4...v0.13.5) (2018-06-08) 95 | 96 | 97 | 98 | 99 | **Note:** Version bump only for package md-specs-project 100 | 101 | 102 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 103 | 104 | 105 | 106 | 107 | **Note:** Version bump only for package md-specs-project 108 | 109 | 110 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 111 | 112 | 113 | 114 | 115 | **Note:** Version bump only for package md-specs-project 116 | 117 | 118 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 119 | 120 | 121 | 122 | 123 | **Note:** Version bump only for package md-specs-project 124 | 125 | 126 | ## [0.12.1](https://github.com/Igmat/baset/compare/v0.12.0...v0.12.1) (2018-05-29) 127 | 128 | 129 | 130 | 131 | **Note:** Version bump only for package md-specs-project 132 | 133 | 134 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 135 | 136 | 137 | 138 | 139 | **Note:** Version bump only for package md-specs-project 140 | -------------------------------------------------------------------------------- /tests/md-specs-project/index.spec.base.md: -------------------------------------------------------------------------------- 1 | JSON values: 2 | ```JSON 3 | [ 4 | { 5 | "numberValue": 4, 6 | "values": [ 7 | "abccbacbaabc", 8 | "1abcabc1" 9 | ] 10 | }, 11 | { 12 | "numberValue": 4, 13 | "values": [ 14 | "abc11abc" 15 | ] 16 | }, 17 | { 18 | "numberValue": 4000000, 19 | "values": [ 20 | "abccbacbaabc", 21 | "1abcabc1" 22 | ] 23 | }, 24 | { 25 | "numberValue": 4000000, 26 | "values": [ 27 | "abc11abc" 28 | ] 29 | }, 30 | { 31 | "value": "function call11function call" 32 | }, 33 | { 34 | "value": "async value11async value" 35 | }, 36 | { 37 | "numberValue": 4, 38 | "values": [ 39 | "abccbacbaabc", 40 | "1abcabc1" 41 | ] 42 | }, 43 | { 44 | "numberValue": 4, 45 | "values": [ 46 | "abc11abc" 47 | ] 48 | }, 49 | { 50 | "numberValue": 4000000, 51 | "values": [ 52 | "abccbacbaabc", 53 | "1abcabc1" 54 | ] 55 | }, 56 | { 57 | "numberValue": 4000000, 58 | "values": [ 59 | "abc11abc" 60 | ] 61 | }, 62 | { 63 | "value": "function call11function call" 64 | }, 65 | { 66 | "value": "async value11async value" 67 | } 68 | ] 69 | ``` -------------------------------------------------------------------------------- /tests/md-specs-project/index.spec.md: -------------------------------------------------------------------------------- 1 | # init 2 | To initialize use: 3 | ```TypeScript 4 | import { sampleFn } from './index'; 5 | ``` 6 | or 7 | ```TypeScript 8 | const { sampleFn } = require('./index'); 9 | ``` 10 | ## usage 11 | First example: 12 | ```TypeScript 13 | export const numberValue = sampleFn(1, 1); 14 | ``` 15 | Second example and: 16 | ```TypeScript 17 | export const numberValue = sampleFn(1000000, 1000000); 18 | ``` 19 | ### specific usage 20 | ```TypeScript 21 | export const values = [ 22 | sampleFn('abc', 'cba'), 23 | sampleFn(1, 'abc'), 24 | ] 25 | ``` 26 | ### second specific usage 27 | ```TypeScript 28 | export const values = [ 29 | sampleFn('abc', 1), 30 | ] 31 | ``` 32 | ## corner cases 33 | First example: 34 | ```TypeScript 35 | export const value = () => sampleFn('function call', 1); 36 | ``` 37 | Second example 38 | ```TypeScript 39 | export const value = new Promise(resolve => resolve(sampleFn('async value', 1))); 40 | ``` 41 | -------------------------------------------------------------------------------- /tests/md-specs-project/index.ts: -------------------------------------------------------------------------------- 1 | export function sampleFn(a: any, b: any) { 2 | return a + b + b + a; 3 | } 4 | -------------------------------------------------------------------------------- /tests/md-specs-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "md-specs-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/md-specs-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "md-specs-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept", 10 | "scaffold": "baset scaffold" 11 | }, 12 | "author": "", 13 | "license": "MIT", 14 | "devDependencies": { 15 | "baset": "^0.14.8", 16 | "baset-baseliner-md": "^0.14.8", 17 | "baset-reader-md": "^0.14.7", 18 | "baset-reader-ts": "^0.14.7", 19 | "typescript": "^3.0.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/md-specs-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "importHelpers": true, 15 | "moduleResolution": "node", 16 | "baseUrl": ".", 17 | "lib": [ 18 | "dom", 19 | "es7" 20 | ], 21 | "paths": { 22 | "*": [ 23 | "node_modules/*", 24 | "src/types/*", 25 | "lib/*" 26 | ] 27 | }, 28 | "experimentalDecorators": true, 29 | "emitDecoratorMetadata": true 30 | }, 31 | "include": [ 32 | "lib/**/*", 33 | "/*.ts" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /tests/sample-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.js", 3 | "bases": "**/*.base" 4 | } 5 | -------------------------------------------------------------------------------- /tests/sample-project/index.js: -------------------------------------------------------------------------------- 1 | const fail = require('asn1'); 2 | 3 | function sampleFn(a, b) { 4 | return a + b; 5 | } 6 | 7 | module.exports.sampleFn = sampleFn; 8 | -------------------------------------------------------------------------------- /tests/sample-project/index.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | 2, 4 | 2000000, 5 | "abccba", 6 | "1abc", 7 | "abc1", 8 | "function call1", 9 | "async value1" 10 | ] 11 | } -------------------------------------------------------------------------------- /tests/sample-project/index.spec.js: -------------------------------------------------------------------------------- 1 | const { sampleFn } = require('./index'); 2 | 3 | module.exports = { 4 | values: [ 5 | sampleFn(1, 1), 6 | sampleFn(1000000, 1000000), 7 | sampleFn('abc', 'cba'), 8 | sampleFn(1, 'abc'), 9 | sampleFn('abc', 1), 10 | () => sampleFn('function call', 1), 11 | new Promise(resolve => resolve(sampleFn('async value', 1))) 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tests/sample-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample-project", 3 | "version": "0.13.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "asn1.js": { 8 | "version": "5.0.1", 9 | "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.0.1.tgz", 10 | "integrity": "sha512-aO8EaEgbgqq77IEw+1jfx5c9zTbzvkfuRBuZsSsPnTHMkmd5AI4J6OtITLZFa381jReeaQL67J0GBTUu0+ZTVw==", 11 | "requires": { 12 | "bn.js": "^4.0.0", 13 | "inherits": "^2.0.1", 14 | "minimalistic-assert": "^1.0.0" 15 | } 16 | }, 17 | "bn.js": { 18 | "version": "4.11.8", 19 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", 20 | "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" 21 | }, 22 | "inherits": { 23 | "version": "2.0.3", 24 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 25 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 26 | }, 27 | "minimalistic-assert": { 28 | "version": "1.0.1", 29 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", 30 | "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/sample-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "asn1.js": "^5.0.1" 15 | }, 16 | "devDependencies": { 17 | "baset": "^0.14.8", 18 | "baset-baseliner-json": "^0.14.8" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/scaffold.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "stdout": [ 3 | "", 4 | "", 5 | "Spec \"index.spec.ts\" is scaffolded", 6 | "Spec \"someClass.spec.ts\" is scaffolded", 7 | "" 8 | ], 9 | "stderr": [] 10 | } -------------------------------------------------------------------------------- /tests/scaffold.spec.ts: -------------------------------------------------------------------------------- 1 | import { sync as spawnSync } from 'cross-spawn'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | const cwd = path.resolve(__dirname, './scaffolded-project'); 6 | const scaffoldProccess = spawnSync('npm', ['run', 'scaffold'], { cwd, encoding: 'utf8' }); 7 | export = { 8 | stdout: scaffoldProccess.stdout.split('\n') 9 | // we don't need to check npm tasks output (like `> baset` or `> path/to/node.exe index.js`) 10 | .filter(line => !line.startsWith('>')), 11 | stderr: scaffoldProccess.stderr.split('\n') 12 | // we don't need to check npm warn about node version used in script 13 | .filter(line => !line.search('`--scripts-prepend-node-path`')), 14 | }; 15 | 16 | /// Clean-up file system 17 | ['someClass.spec.ts', 'index.spec.ts'] 18 | .map(file => path.resolve(cwd, file)) 19 | .forEach(fs.unlinkSync); 20 | -------------------------------------------------------------------------------- /tests/scaffolded-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts", 3 | "files": "**/*.ts", 4 | "bases": "**/*.base", 5 | "plugins": { 6 | ".spec.js$": "baset-baseliner-json", 7 | ".spec.ts$": { 8 | "readers": "baset-reader-ts", 9 | "baseliner": "baset-baseliner-json", 10 | "imports": "./polyfill" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/scaffolded-project/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | **/*/dist 5 | /dist 6 | **/*/build 7 | /build 8 | **/*/tmp 9 | /tmp 10 | **/*/out-tsc 11 | /out-tsc 12 | 13 | # dependencies 14 | **/*/node_modules 15 | /node_modules 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | /.vs 26 | /iac/.vs 27 | 28 | # IDE - VSCode 29 | .vscode/* 30 | !.vscode/settings.json 31 | !.vscode/tasks.json 32 | !.vscode/launch.json 33 | !.vscode/extensions.json 34 | !.vscode/cSpell.json 35 | 36 | # misc 37 | **/*/.sass-cache 38 | /.sass-cache 39 | **/*/connect.lock 40 | /connect.lock 41 | **/*/coverage 42 | /coverage 43 | **/*/libpeerconnection.log 44 | /libpeerconnection.log 45 | yarn-error.log 46 | *.iml 47 | npm-debug.log 48 | .soliumignore 49 | .soliumrc.json 50 | testem.log 51 | **/*/typings 52 | /typings 53 | 54 | # e2e 55 | **/*/e2e/*.js 56 | /e2e/*.js 57 | **/*/e2e/*.map 58 | /e2e/*.map 59 | 60 | # System Files 61 | .DS_Store 62 | Thumbs.db 63 | lerna-debug.log 64 | 65 | # tmp baseline 66 | **/*.spec.md 67 | **/*.spec.ts 68 | **/*.spec.tmp.md 69 | **/*.spec.tmp.base 70 | -------------------------------------------------------------------------------- /tests/scaffolded-project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.8](https://github.com/Igmat/baset/compare/v0.14.7...v0.14.8) (2018-10-10) 8 | 9 | **Note:** Version bump only for package scaffolded-project 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 17 | 18 | **Note:** Version bump only for package scaffolded-project 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 26 | 27 | **Note:** Version bump only for package scaffolded-project 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.5](https://github.com/Igmat/baset/compare/v0.14.4...v0.14.5) (2018-10-09) 35 | 36 | **Note:** Version bump only for package scaffolded-project 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 44 | 45 | **Note:** Version bump only for package scaffolded-project 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 53 | 54 | **Note:** Version bump only for package scaffolded-project 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 62 | 63 | **Note:** Version bump only for package scaffolded-project 64 | 65 | 66 | 67 | 68 | 69 | 70 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 71 | 72 | 73 | 74 | 75 | **Note:** Version bump only for package scaffolded-project 76 | 77 | 78 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 79 | 80 | 81 | 82 | 83 | **Note:** Version bump only for package scaffolded-project 84 | 85 | 86 | ## [0.13.5](https://github.com/Igmat/baset/compare/v0.13.4...v0.13.5) (2018-06-08) 87 | 88 | 89 | 90 | 91 | **Note:** Version bump only for package scaffolded-project 92 | 93 | 94 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 95 | 96 | 97 | 98 | 99 | **Note:** Version bump only for package scaffolded-project 100 | 101 | 102 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 103 | 104 | 105 | 106 | 107 | **Note:** Version bump only for package scaffolded-project 108 | 109 | 110 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 111 | 112 | 113 | 114 | 115 | **Note:** Version bump only for package scaffolded-project 116 | 117 | 118 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 119 | 120 | 121 | 122 | 123 | **Note:** Version bump only for package scaffolded-project 124 | 125 | 126 | ## [0.11.1](https://github.com/Igmat/baset/compare/v0.11.0...v0.11.1) (2018-03-15) 127 | 128 | 129 | 130 | 131 | **Note:** Version bump only for package scaffolded-project 132 | 133 | 134 | # [0.11.0](https://github.com/Igmat/baset/compare/v0.10.0...v0.11.0) (2018-03-08) 135 | 136 | 137 | 138 | 139 | **Note:** Version bump only for package scaffolded-project 140 | -------------------------------------------------------------------------------- /tests/scaffolded-project/index.ts: -------------------------------------------------------------------------------- 1 | export function sampleFn(a: any, b: any) { 2 | return a + b + b + a; 3 | } 4 | export default function sample(a: string, b: string): string; 5 | export default function sample(a: number, b: number): number; 6 | export default function sample(a: any, b: any) { 7 | return a + b; 8 | } 9 | -------------------------------------------------------------------------------- /tests/scaffolded-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scaffolded-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/scaffolded-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scaffolded-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept", 10 | "scaffold": "baset scaffold" 11 | }, 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": { 15 | "reflect-metadata": "^0.1.12", 16 | "tslib": "^1.9.3" 17 | }, 18 | "devDependencies": { 19 | "baset": "^0.14.8", 20 | "baset-baseliner-json": "^0.14.8", 21 | "baset-reader-ts": "^0.14.7", 22 | "typescript": "^3.0.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/scaffolded-project/someClass.ts: -------------------------------------------------------------------------------- 1 | export class SomeClass { 2 | constructor(a: number, b: number, c: number) 3 | constructor(private a = 1, private b = 10, c: number) { 4 | this.b = b * c; 5 | } 6 | 7 | getSum() { 8 | return this.a + this.b; 9 | } 10 | 11 | getMultipliedSum(multiplier: number) { 12 | return this.getSum() * multiplier; 13 | } 14 | 15 | getStringOrNumberSum(a: string, b: string): string; 16 | getStringOrNumberSum(a: number, b: number): number; 17 | getStringOrNumberSum(a: string, b: number): undefined; 18 | getStringOrNumberSum(a: number, b: string): undefined; 19 | getStringOrNumberSum(a: string | number, b: string | number) { 20 | if (typeof a === 'string') { 21 | if (typeof b === 'string') return a + b + this.getSum().toString(); 22 | 23 | return; 24 | } 25 | if (typeof b === 'number') return a + b + this.getSum(); 26 | 27 | return; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/scaffolded-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "importHelpers": true, 15 | "moduleResolution": "node", 16 | "baseUrl": ".", 17 | "lib": [ 18 | "dom", 19 | "es7" 20 | ], 21 | "paths": { 22 | "*": [ 23 | "node_modules/*", 24 | "src/types/*" 25 | ] 26 | }, 27 | "experimentalDecorators": true, 28 | "emitDecoratorMetadata": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/test.spec.ts: -------------------------------------------------------------------------------- 1 | import { sync as spawnSync } from 'cross-spawn'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | export = fs.readdirSync(__dirname) 6 | .filter(source => fs.lstatSync(path.join(__dirname, source)).isDirectory()) 7 | .filter(project => project !== 'scaffolded-project') 8 | .map(project => { 9 | const cwd = path.resolve(__dirname, `./${project}`); 10 | const testProccess = spawnSync('npm', ['test'], { cwd, encoding: 'utf8' }); 11 | 12 | return { 13 | project, 14 | stdout: testProccess.stdout.split('\n') 15 | // we don't need to check npm tasks output (like `> baset` or `> path/to/node.exe index.js`) 16 | .filter(line => !line.startsWith('>')) 17 | .filter(line => !line.startsWith('PixiJS')) 18 | .map(line => line 19 | .replace(/\(.*m?s\)/, '') // we don't need timing output from `tap-diff` here 20 | .replace(/(✔|√)/, ' ')), // `tap-diff` has different signs on win and *nix 21 | stderr: testProccess.stderr.split('\n') 22 | // we don't need to check npm warn about node version used in script 23 | .filter(line => !line.search('`--scripts-prepend-node-path`')), 24 | }; 25 | }); 26 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts?(x)", 3 | "bases": "**/*.spec.base.md", 4 | "plugins": { 5 | ".spec.tsx?$": { 6 | "environment": "baset-env-browser", 7 | "readers": ["baset-reader-ts", "baset-reader-babel"], 8 | "resolvers": "baset-resolver-react", 9 | "baseliner": "baset-baseliner-md" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/index.spec.base.md: -------------------------------------------------------------------------------- 1 | `exports.value:` 2 | 3 | ```HTML 4 |
5 |
8 | ss 9 |
10 |
13 | abccba 14 |
15 |
18 | sabc 19 |
20 |
23 | abcs 24 |
25 |
26 | ``` -------------------------------------------------------------------------------- /tests/tsx-babel-project/index.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { jsxFn } from './index'; 3 | 4 | export const value = ( 5 |
6 | {jsxFn('s', 's')} 7 | {jsxFn('abc', 'cba')} 8 | {jsxFn('s', 'abc')} 9 | {jsxFn('abc', 's')} 10 |
11 | ); 12 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export const jsxFn = (a: string, b: string) => (
{a + b}
); 4 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-babel-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-babel-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "react": "^16.5.1", 15 | "react-dom": "^16.5.1" 16 | }, 17 | "devDependencies": { 18 | "@types/react": "^16.4.14", 19 | "@types/react-dom": "^16.0.7", 20 | "babel-cli": "^6.26.0", 21 | "babel-preset-es2015": "^6.24.1", 22 | "babel-preset-react": "^6.24.1", 23 | "baset": "^0.14.8", 24 | "baset-baseliner-md": "^0.14.8", 25 | "baset-env-browser": "^0.14.7", 26 | "baset-reader-babel": "^0.14.7", 27 | "baset-reader-ts": "^0.14.7", 28 | "baset-resolver-react": "^0.14.7", 29 | "typescript": "^3.0.3" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/tsx-babel-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "baseUrl": ".", 16 | "jsx": "preserve", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*", 21 | "lib/*" 22 | ] 23 | }, 24 | "experimentalDecorators": true, 25 | "emitDecoratorMetadata": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/tsx-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts?(x)", 3 | "bases": "**/*.spec.base.md", 4 | "plugins": { 5 | ".spec.tsx?$": ["baset-env-browser", "baset-reader-ts", "baset-resolver-react", "baset-baseliner-md"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/tsx-project/index.spec.base.md: -------------------------------------------------------------------------------- 1 | `exports.value:` 2 | 3 | ```HTML 4 |
5 |
8 | ss 9 |
10 |
13 | abccba 14 |
15 |
18 | sabc 19 |
20 |
23 | abcs 24 |
25 |
26 | ``` -------------------------------------------------------------------------------- /tests/tsx-project/index.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { jsxFn } from './index'; 3 | 4 | export const value = ( 5 |
6 | {jsxFn('s', 's')} 7 | {jsxFn('abc', 'cba')} 8 | {jsxFn('s', 'abc')} 9 | {jsxFn('abc', 's')} 10 |
11 | ); 12 | -------------------------------------------------------------------------------- /tests/tsx-project/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export const jsxFn = (a, b) => (
{a + b}
); 4 | -------------------------------------------------------------------------------- /tests/tsx-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/react": { 8 | "version": "16.4.14", 9 | "resolved": "https://registry.npmjs.org/@types/react/-/react-16.4.14.tgz", 10 | "integrity": "sha512-Gh8irag2dbZ2K6vPn+S8+LNrULuG3zlCgJjVUrvuiUK7waw9d9CFk2A/tZFyGhcMDUyO7tznbx1ZasqlAGjHxA==", 11 | "dev": true, 12 | "requires": { 13 | "@types/prop-types": "*", 14 | "csstype": "^2.2.0" 15 | }, 16 | "dependencies": { 17 | "@types/prop-types": { 18 | "version": "15.5.5", 19 | "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.5.tgz", 20 | "integrity": "sha512-mOrlCEdwX3seT3n0AXNt4KNPAZZxcsABUHwBgFXOt+nvFUXkxCAO6UBJHPrDxWEa2KDMil86355fjo8jbZ+K0Q==", 21 | "dev": true, 22 | "requires": { 23 | "@types/react": "*" 24 | } 25 | }, 26 | "csstype": { 27 | "version": "2.5.7", 28 | "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.5.7.tgz", 29 | "integrity": "sha512-Nt5VDyOTIIV4/nRFswoCKps1R5CD1hkiyjBE9/thNaNZILLEviVw9yWQw15+O+CpNjQKB/uvdcxFFOrSflY3Yw==", 30 | "dev": true 31 | } 32 | } 33 | }, 34 | "@types/react-dom": { 35 | "version": "16.0.7", 36 | "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.0.7.tgz", 37 | "integrity": "sha512-vaq4vMaJOaNgFff1t3LnHYr6vRa09vRspMkmLdXtFZmO1fwDI2snP+dpOkwrtlU8UC8qsqemCu4RmVM2OLq/fA==", 38 | "dev": true, 39 | "requires": { 40 | "@types/node": "*", 41 | "@types/react": "*" 42 | }, 43 | "dependencies": { 44 | "@types/node": { 45 | "version": "10.10.0", 46 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.10.0.tgz", 47 | "integrity": "sha512-0V36JTaif20jrbTbZeKqnI4R8nLVE8Ah/u9dQT5jIKXjW51/4ipi/B8Xon1ZiEHATYpgLNoBw2LFfdBMoA5Fzg==", 48 | "dev": true 49 | } 50 | } 51 | }, 52 | "typescript": { 53 | "version": "3.5.1", 54 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz", 55 | "integrity": "sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==", 56 | "dev": true 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /tests/tsx-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "react": "^16.5.1", 15 | "react-dom": "^16.5.1" 16 | }, 17 | "devDependencies": { 18 | "@types/react": "^16.0.38", 19 | "@types/react-dom": "^16.0.4", 20 | "baset": "^0.14.8", 21 | "baset-baseliner-md": "^0.14.8", 22 | "baset-env-browser": "^0.14.7", 23 | "baset-reader-ts": "^0.14.7", 24 | "baset-resolver-react": "^0.14.7", 25 | "typescript": "^3.0.3" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/tsx-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "baseUrl": ".", 16 | "jsx": "react", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*", 21 | "lib/*" 22 | ] 23 | }, 24 | "experimentalDecorators": true, 25 | "emitDecoratorMetadata": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts?(x)", 3 | "bases": "**/*.spec.base.md", 4 | "plugins": { 5 | ".spec.tsx?$": { 6 | "readers": ["./scripts/baset-assets-reader.js", "baset-reader-ts"], 7 | "resolvers": "baset-resolver-react", 8 | "baseliner": "baset-baseliner-md", 9 | "mocks": { 10 | "styled-components": "./src/mocks/styled" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.8](https://github.com/Igmat/baset/compare/v0.14.7...v0.14.8) (2018-10-10) 8 | 9 | **Note:** Version bump only for package tsx-styled-components-project 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 17 | 18 | **Note:** Version bump only for package tsx-styled-components-project 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 26 | 27 | **Note:** Version bump only for package tsx-styled-components-project 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.5](https://github.com/Igmat/baset/compare/v0.14.4...v0.14.5) (2018-10-09) 35 | 36 | **Note:** Version bump only for package tsx-styled-components-project 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 44 | 45 | **Note:** Version bump only for package tsx-styled-components-project 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 53 | 54 | **Note:** Version bump only for package tsx-styled-components-project 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 62 | 63 | **Note:** Version bump only for package tsx-styled-components-project 64 | 65 | 66 | 67 | 68 | 69 | 70 | ## [0.14.1](https://github.com/Igmat/baset/compare/v0.14.0...v0.14.1) (2018-09-04) 71 | 72 | 73 | 74 | 75 | **Note:** Version bump only for package tsx-styled-components-project 76 | 77 | 78 | # [0.14.0](https://github.com/Igmat/baset/compare/v0.13.7...v0.14.0) (2018-09-04) 79 | 80 | 81 | 82 | 83 | **Note:** Version bump only for package tsx-styled-components-project 84 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/images.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.svg' 2 | declare module '*.png' 3 | declare module '*.jpg' 4 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-styled-components-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsx-styled-components-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.5.1", 7 | "react-dom": "^16.5.1", 8 | "react-scripts-ts": "^2.17.0", 9 | "styled-components": "^3.4.6" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts-ts start", 13 | "build": "react-scripts-ts build", 14 | "test": "baset", 15 | "accept": "baset a", 16 | "eject": "react-scripts-ts eject" 17 | }, 18 | "devDependencies": { 19 | "@types/jest": "^23.3.2", 20 | "@types/node": "^10.10.0", 21 | "@types/react": "^16.4.14", 22 | "@types/react-dom": "^16.0.7", 23 | "@types/styled-components": "^3.0.1", 24 | "baset": "^0.14.8", 25 | "baset-baseliner-md": "^0.14.8", 26 | "baset-core": "^0.14.7", 27 | "baset-env-browser": "^0.14.7", 28 | "baset-reader-ts": "^0.14.7", 29 | "baset-resolver-react": "^0.14.7", 30 | "typescript": "^3.0.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Igmat/baset/a1ac7e9ca45a23846b01dd977f1951948f29d652/tests/tsx-styled-components-project/public/favicon.ico -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/scripts/baset-assets-reader.js: -------------------------------------------------------------------------------- 1 | const { AbstractReader } = require('baset-core'); 2 | 3 | const mockCode = ` 4 | const path = require('path'); 5 | module.exports.default = path.relative(process.cwd(), __filename).split(path.sep).join('/'); 6 | ` 7 | class AssetsReader extends AbstractReader { 8 | constructor(options) { 9 | super(options); 10 | this.exts = ['.css', '.less', '.jpg', '.png', '.svg', '.woff', '.woff2'] 11 | 12 | this.read = (filePath, spec) => spec; 13 | 14 | this.registerHook = (addHook, addFileResolver) => 15 | addHook( 16 | (code, filename) => mockCode, 17 | { 18 | exts: this.exts, 19 | matcher: filename => /\.(css|less|jpg|png|svg|woff|woff2)$/i.test(filename) 20 | }); 21 | } 22 | } 23 | 24 | exports.default = AssetsReader; 25 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/App.spec.base.md: -------------------------------------------------------------------------------- 1 | `exports.default:` 2 | 3 | ```HTML 4 |
7 |
10 | logo 15 |

18 | Welcome to React 19 |

20 |
21 |

24 | hi from mock 25 | To get started, edit 26 | 27 | src/App.tsx 28 | 29 | and save to reload. 30 |

31 |
32 | ``` -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/App.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import App from "./App"; 3 | 4 | export default 5 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import styled, { injectGlobal } from 'styled-components'; 3 | import './App.css'; 4 | 5 | import logo from './logo.svg'; 6 | 7 | const Introduction = styled.p` 8 | font-weight: 900; 9 | font-size: large; 10 | `; 11 | 12 | class App extends React.Component { 13 | public render() { 14 | return ( 15 |
16 |
17 | logo 18 |

Welcome to React

19 |
20 | 21 | { injectGlobal`` } 22 | To get started, edit src/App.tsx and save to reload. 23 | 24 |
25 | ); 26 | } 27 | } 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import './index.css'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('root') as HTMLElement 10 | ); 11 | registerServiceWorker(); 12 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/src/mocks/styled.ts: -------------------------------------------------------------------------------- 1 | import * as styled from 'styled-components'; 2 | 3 | export = { 4 | ...styled, 5 | injectGlobal: () => 'hi from mock', 6 | } 7 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "outDir": "build/dist", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "lib": ["es6", "dom"], 8 | "sourceMap": true, 9 | "allowJs": true, 10 | "jsx": "react", 11 | "moduleResolution": "node", 12 | "rootDir": "src", 13 | "forceConsistentCasingInFileNames": true, 14 | "noImplicitReturns": true, 15 | "noImplicitThis": true, 16 | "noImplicitAny": true, 17 | "strictNullChecks": true, 18 | "suppressImplicitAnyIndexErrors": true, 19 | "noUnusedLocals": true 20 | }, 21 | "exclude": [ 22 | "node_modules", 23 | "build", 24 | "scripts", 25 | "acceptance-tests", 26 | "webpack", 27 | "jest", 28 | "src/setupTests.ts" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json" 3 | } -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /tests/tsx-styled-components-project/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], 3 | "linterOptions": { 4 | "exclude": [ 5 | "config/**/*.js", 6 | "node_modules/**/*.ts", 7 | "coverage/lcov-report/*.js" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/typescript-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts", 3 | "files": "**/*.ts", 4 | "bases": "**/*.base", 5 | "plugins": { 6 | ".spec.js$": "baset-baseliner-json", 7 | ".spec.ts$": { 8 | "readers": "baset-reader-ts", 9 | "baseliner": "baset-baseliner-json", 10 | "imports": "./polyfill" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/typescript-project/index.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | 4, 4 | 4000000, 5 | "abccbacbaabc", 6 | "1abcabc1", 7 | "abc11abc", 8 | "function call11function call", 9 | "async value11async value" 10 | ] 11 | } -------------------------------------------------------------------------------- /tests/typescript-project/index.spec.ts: -------------------------------------------------------------------------------- 1 | import { sampleFn } from './index'; 2 | 3 | export = { 4 | values: [ 5 | sampleFn(1, 1), 6 | sampleFn(1000000, 1000000), 7 | sampleFn('abc', 'cba'), 8 | sampleFn(1, 'abc'), 9 | sampleFn('abc', 1), 10 | () => sampleFn('function call', 1), 11 | new Promise(resolve => resolve(sampleFn('async value', 1))), 12 | ], 13 | }; 14 | -------------------------------------------------------------------------------- /tests/typescript-project/index.ts: -------------------------------------------------------------------------------- 1 | export function sampleFn(a: any, b: any) { 2 | return a + b + b + a; 3 | } 4 | -------------------------------------------------------------------------------- /tests/typescript-project/lib/someCoolClass.ts: -------------------------------------------------------------------------------- 1 | function logParamTypes(target: any, key: string) { 2 | const types = Reflect.getMetadata('design:paramtypes', target, key); 3 | const s = types.map((a: any) => a.name).join(); 4 | } 5 | 6 | export class SomeCoolClass { 7 | private a = 1000; 8 | private b = 300; 9 | 10 | @logParamTypes 11 | getSum() { 12 | return this.a + this.b; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/typescript-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/typescript-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept", 10 | "scaffold": "baset scaffold" 11 | }, 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": { 15 | "reflect-metadata": "^0.1.12", 16 | "tslib": "^1.9.3" 17 | }, 18 | "devDependencies": { 19 | "baset": "^0.14.8", 20 | "baset-baseliner-json": "^0.14.8", 21 | "baset-reader-ts": "^0.14.7", 22 | "typescript": "^3.0.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/typescript-project/pathImport.spec.base: -------------------------------------------------------------------------------- 1 | { "sum": 1300 } -------------------------------------------------------------------------------- /tests/typescript-project/pathImport.spec.ts: -------------------------------------------------------------------------------- 1 | import { SomeCoolClass } from 'someCoolClass'; 2 | 3 | export const sum = new SomeCoolClass().getSum(); 4 | -------------------------------------------------------------------------------- /tests/typescript-project/polyfill.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | -------------------------------------------------------------------------------- /tests/typescript-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "importHelpers": true, 15 | "moduleResolution": "node", 16 | "baseUrl": ".", 17 | "lib": [ 18 | "dom", 19 | "es7" 20 | ], 21 | "paths": { 22 | "*": [ 23 | "node_modules/*", 24 | "src/types/*", 25 | "lib/*" 26 | ] 27 | }, 28 | "experimentalDecorators": true, 29 | "emitDecoratorMetadata": true 30 | }, 31 | "include": [ 32 | "lib/**/*", 33 | "/*.ts" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/.basetrc: -------------------------------------------------------------------------------- 1 | { 2 | "specs": "**/*.spec.ts", 3 | "bases": "**/*.base", 4 | "plugins": { 5 | ".spec.ts$": ["baset-env-browser", "baset-reader-ts", "baset-baseliner-json"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.14.8](https://github.com/Igmat/baset/compare/v0.14.7...v0.14.8) (2018-10-10) 8 | 9 | **Note:** Version bump only for package umd-like-dep-project 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## [0.14.7](https://github.com/Igmat/baset/compare/v0.14.6...v0.14.7) (2018-10-10) 17 | 18 | **Note:** Version bump only for package umd-like-dep-project 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## [0.14.6](https://github.com/Igmat/baset/compare/v0.14.5...v0.14.6) (2018-10-09) 26 | 27 | **Note:** Version bump only for package umd-like-dep-project 28 | 29 | 30 | 31 | 32 | 33 | 34 | ## [0.14.5](https://github.com/Igmat/baset/compare/v0.14.4...v0.14.5) (2018-10-09) 35 | 36 | **Note:** Version bump only for package umd-like-dep-project 37 | 38 | 39 | 40 | 41 | 42 | 43 | ## [0.14.4](https://github.com/Igmat/baset/compare/v0.14.3...v0.14.4) (2018-10-07) 44 | 45 | **Note:** Version bump only for package umd-like-dep-project 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## [0.14.3](https://github.com/Igmat/baset/compare/v0.14.2...v0.14.3) (2018-10-07) 53 | 54 | **Note:** Version bump only for package umd-like-dep-project 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## [0.14.2](https://github.com/Igmat/baset/compare/v0.14.1...v0.14.2) (2018-09-17) 62 | 63 | **Note:** Version bump only for package umd-like-dep-project 64 | 65 | 66 | 67 | 68 | 69 | 70 | ## [0.13.7](https://github.com/Igmat/baset/compare/v0.13.6...v0.13.7) (2018-08-30) 71 | 72 | 73 | 74 | 75 | **Note:** Version bump only for package umd-like-dep-project 76 | 77 | 78 | ## [0.13.6](https://github.com/Igmat/baset/compare/v0.13.5...v0.13.6) (2018-06-10) 79 | 80 | 81 | 82 | 83 | **Note:** Version bump only for package umd-like-dep-project 84 | 85 | 86 | ## [0.13.5](https://github.com/Igmat/baset/compare/v0.13.4...v0.13.5) (2018-06-08) 87 | 88 | 89 | 90 | 91 | **Note:** Version bump only for package umd-like-dep-project 92 | 93 | 94 | ## [0.13.4](https://github.com/Igmat/baset/compare/v0.13.3...v0.13.4) (2018-06-08) 95 | 96 | 97 | 98 | 99 | **Note:** Version bump only for package umd-like-dep-project 100 | 101 | 102 | ## [0.13.2](https://github.com/Igmat/baset/compare/v0.13.1...v0.13.2) (2018-06-07) 103 | 104 | 105 | 106 | 107 | **Note:** Version bump only for package umd-like-dep-project 108 | 109 | 110 | ## [0.13.1](https://github.com/Igmat/baset/compare/v0.13.0...v0.13.1) (2018-06-02) 111 | 112 | 113 | 114 | 115 | **Note:** Version bump only for package umd-like-dep-project 116 | 117 | 118 | # [0.13.0](https://github.com/Igmat/baset/compare/v0.12.1...v0.13.0) (2018-05-31) 119 | 120 | 121 | 122 | 123 | **Note:** Version bump only for package umd-like-dep-project 124 | 125 | 126 | # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03) 127 | 128 | 129 | 130 | 131 | **Note:** Version bump only for package umd-like-dep-project 132 | 133 | 134 | ## [0.11.1](https://github.com/Igmat/baset/compare/v0.11.0...v0.11.1) (2018-03-15) 135 | 136 | 137 | 138 | 139 | **Note:** Version bump only for package umd-like-dep-project 140 | 141 | 142 | # [0.11.0](https://github.com/Igmat/baset/compare/v0.10.0...v0.11.0) (2018-03-08) 143 | 144 | 145 | 146 | 147 | **Note:** Version bump only for package umd-like-dep-project 148 | 149 | 150 | # [0.10.0](https://github.com/Igmat/baset/compare/v0.9.1...v0.10.0) (2018-03-07) 151 | 152 | 153 | 154 | 155 | **Note:** Version bump only for package umd-like-dep-project 156 | 157 | 158 | # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) 159 | 160 | 161 | 162 | 163 | **Note:** Version bump only for package umd-like-dep-project 164 | 165 | 166 | # [0.8.0](https://github.com/Igmat/baset/compare/v0.7.5...v0.8.0) (2018-02-28) 167 | 168 | 169 | 170 | 171 | **Note:** Version bump only for package umd-like-dep-project 172 | 173 | 174 | ## [0.7.5](https://github.com/Igmat/baset/compare/v0.7.4...v0.7.5) (2018-02-27) 175 | 176 | 177 | 178 | 179 | **Note:** Version bump only for package umd-like-dep-project 180 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/index.spec.base: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | 4, 4 | 4000000, 5 | "abccbacbaabc", 6 | "1abcabc1", 7 | "abc11abc", 8 | "function call11function call", 9 | "async value11async value" 10 | ] 11 | } -------------------------------------------------------------------------------- /tests/umd-like-dep-project/index.spec.ts: -------------------------------------------------------------------------------- 1 | import { sampleFn } from './index'; 2 | 3 | export = { 4 | values: [ 5 | sampleFn(1, 1), 6 | sampleFn(1000000, 1000000), 7 | sampleFn('abc', 'cba'), 8 | sampleFn(1, 'abc'), 9 | sampleFn('abc', 1), 10 | () => sampleFn('function call', 1), 11 | new Promise(resolve => resolve(sampleFn('async value', 1))), 12 | ], 13 | }; 14 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/index.ts: -------------------------------------------------------------------------------- 1 | import { Howl } from 'howler'; 2 | 3 | const sound = new Howl({ src: '' }); 4 | export function sampleFn(a: any, b: any) { 5 | return a + b + b + a; 6 | } 7 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "umd-like-dep-project", 3 | "version": "0.14.8", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "3.0.3", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 10 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 11 | "dev": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "umd-like-dep-project", 3 | "version": "0.14.8", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "baset", 9 | "accept": "baset accept" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "dependencies": { 14 | "howler": "^2.0.15" 15 | }, 16 | "devDependencies": { 17 | "@types/howler": "^2.0.5", 18 | "baset": "^0.14.8", 19 | "baset-baseliner-json": "^0.14.8", 20 | "baset-env-browser": "^0.14.7", 21 | "baset-reader-ts": "^0.14.7", 22 | "typescript": "^3.0.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/umd-like-dep-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "outDir": "dist", 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "strictNullChecks": true, 11 | "noImplicitThis": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*", 20 | "lib/*" 21 | ] 22 | }, 23 | "experimentalDecorators": true, 24 | "emitDecoratorMetadata": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "strict": true, 8 | "noImplicitAny": true, 9 | "strictNullChecks": true, 10 | "noImplicitThis": true, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "pretty": true, 17 | "esModuleInterop": true 18 | } 19 | } 20 | --------------------------------------------------------------------------------