Skip to content

Commit

Permalink
Merge pull request #35 from 2gis/TILES-5081-tests
Browse files Browse the repository at this point in the history
Tiles 5081 tests
  • Loading branch information
iv-berezin authored May 23, 2024
2 parents 987294c + e290372 commit f280b1d
Show file tree
Hide file tree
Showing 21 changed files with 11,189 additions and 2,520 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/prettier-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Prettier check

on: push

jobs:
prettier-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm run prettier
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test deck2gisLayer plugin

on:
push:
branches:
- '*'
tags-ignore:
- '*'

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm run test:screenshots
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
path: test/screenshots/__screenshots__/**/__diff_output__/*.png
retention-days: 5
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Deck2gisLayer uses github-flow to accept & merge fixes and improvements. Basic p
- Fork the repo.
- Create a branch.
- Add or fix some code.
- **Run testing suite with `npm run docker:test` and make sure nothing is broken**
- **Run testing suite with `npm run test:screenshots` and make sure nothing is broken**
- Add some tests for your new code or fix broken tests.
- Commit & push.
- Create a new pull request to original repo.
Expand All @@ -58,12 +58,7 @@ Also, if you modify packages or add them to `package.json`, make sure you use `n

### Run tests
```shell
npm run docker:test
```

### Update screenshots
```shell
npm run docker:screenshot:update
npm run test:screenshots
```

## Release
Expand Down
27 changes: 27 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const suite = process.env.TEST_SUITE || 'screenshots';

const suiteParams = {
screenshots: {
globalSetup: './test/global-setup.js',
globalTeardown: './test/global-teardown.js',
maxWorkers: 5,
maxConcurrency: 3,
testTimeout: 50000,
testEnvironment: 'node',
testMatch: ['**/test/screenshots/**/*.ts'],
},
};

module.exports = {
preset: 'ts-jest',
globals: {
'ts-jest': {
diagnostics: {
// Игнорируем воргинги про esModuleInterop, которые нам чинить, кажется не требуется
// потому что в тестах импорты работают без проблем.
ignoreCodes: [151001],
},
},
},
...suiteParams[suite],
};
Loading

0 comments on commit f280b1d

Please sign in to comment.