@ethersphere/bee-js 2.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -2
  3. package/dist/index.browser.min.js +1 -1
  4. package/dist/index.browser.min.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist/src/bee-debug.d.ts +38 -6
  8. package/dist/src/bee.d.ts +34 -46
  9. package/dist/src/modules/chunk.d.ts +2 -10
  10. package/dist/src/modules/debug/stamps.d.ts +2 -0
  11. package/dist/src/modules/debug/status.d.ts +10 -4
  12. package/dist/src/modules/stewardship.d.ts +1 -0
  13. package/dist/src/types/debug.d.ts +11 -0
  14. package/dist/src/types/index.d.ts +6 -7
  15. package/dist/src/utils/bytes.d.ts +1 -1
  16. package/dist/src/utils/expose.d.ts +1 -0
  17. package/dist/src/utils/stamps.d.ts +12 -0
  18. package/package.json +10 -8
  19. package/.babelrc.js +0 -33
  20. package/.depcheckrc.json +0 -27
  21. package/.editorconfig +0 -6
  22. package/.eslintignore +0 -1
  23. package/.eslintrc.js +0 -109
  24. package/.gitattributes +0 -1
  25. package/.github/config.yaml +0 -23
  26. package/.github/workflows/check.yaml +0 -57
  27. package/.github/workflows/publish_npmjs.yaml +0 -20
  28. package/.github/workflows/release_github.yaml +0 -20
  29. package/.github/workflows/tests.yaml +0 -128
  30. package/.huskyrc +0 -5
  31. package/.prettierrc +0 -13
  32. package/.vscode/launch.json +0 -49
  33. package/.vscode/settings.json +0 -39
  34. package/CODEOWNERS +0 -1
  35. package/CODE_OF_CONDUCT.md +0 -76
  36. package/commitlint.config.js +0 -3
  37. package/dist/src/modules/stamps.d.ts +0 -4
  38. package/jest-puppeteer.config.js +0 -5
  39. package/jest.config.ts +0 -85
  40. package/src/bee-debug.ts +0 -559
  41. package/src/bee.ts +0 -1070
  42. package/src/chunk/bmt.ts +0 -55
  43. package/src/chunk/cac.ts +0 -79
  44. package/src/chunk/serialize.ts +0 -16
  45. package/src/chunk/signer.ts +0 -141
  46. package/src/chunk/soc.ts +0 -190
  47. package/src/chunk/span.ts +0 -33
  48. package/src/feed/index.ts +0 -217
  49. package/src/feed/json.ts +0 -33
  50. package/src/feed/topic.ts +0 -23
  51. package/src/feed/type.ts +0 -12
  52. package/src/index.ts +0 -24
  53. package/src/modules/bytes.ts +0 -70
  54. package/src/modules/bzz.ts +0 -179
  55. package/src/modules/chunk.ts +0 -69
  56. package/src/modules/debug/balance.ts +0 -63
  57. package/src/modules/debug/chequebook.ts +0 -175
  58. package/src/modules/debug/chunk.ts +0 -39
  59. package/src/modules/debug/connectivity.ts +0 -61
  60. package/src/modules/debug/settlements.ts +0 -33
  61. package/src/modules/debug/stamps.ts +0 -76
  62. package/src/modules/debug/states.ts +0 -35
  63. package/src/modules/debug/status.ts +0 -35
  64. package/src/modules/debug/tag.ts +0 -19
  65. package/src/modules/debug/transactions.ts +0 -79
  66. package/src/modules/feed.ts +0 -105
  67. package/src/modules/pinning.ts +0 -74
  68. package/src/modules/pss.ts +0 -49
  69. package/src/modules/soc.ts +0 -40
  70. package/src/modules/stamps.ts +0 -59
  71. package/src/modules/status.ts +0 -13
  72. package/src/modules/stewardship.ts +0 -18
  73. package/src/modules/tag.ts +0 -83
  74. package/src/types/debug.ts +0 -204
  75. package/src/types/index.ts +0 -566
  76. package/src/types/ky-universal/common.d.ts +0 -17
  77. package/src/types/ky-universal/hooks.d.ts +0 -103
  78. package/src/types/ky-universal/index.d.ts +0 -125
  79. package/src/types/ky-universal/options.d.ts +0 -235
  80. package/src/types/ky-universal/response.d.ts +0 -38
  81. package/src/types/ky-universal/retry.d.ts +0 -39
  82. package/src/types/tar-js.d.ts +0 -1
  83. package/src/types/webpack-bundle-analyzer/index.d.ts +0 -13
  84. package/src/utils/bytes.ts +0 -144
  85. package/src/utils/collection.ts +0 -151
  86. package/src/utils/data.browser.ts +0 -68
  87. package/src/utils/data.ts +0 -48
  88. package/src/utils/error.ts +0 -23
  89. package/src/utils/eth.ts +0 -229
  90. package/src/utils/expose.ts +0 -48
  91. package/src/utils/file.ts +0 -40
  92. package/src/utils/hash.ts +0 -16
  93. package/src/utils/headers.ts +0 -63
  94. package/src/utils/hex.ts +0 -186
  95. package/src/utils/http.ts +0 -141
  96. package/src/utils/merge.ts +0 -34
  97. package/src/utils/pss.ts +0 -16
  98. package/src/utils/stream.ts +0 -146
  99. package/src/utils/tar.ts +0 -30
  100. package/src/utils/type.ts +0 -394
  101. package/src/utils/uint64.ts +0 -31
  102. package/src/utils/url.ts +0 -52
  103. package/test/bee.sh +0 -187
  104. package/test/data/1.txt +0 -1
  105. package/test/data/2.txt +0 -0
  106. package/test/data/empty +0 -0
  107. package/test/data/sub/3.txt +0 -1
  108. package/test/data/sub//303/251 +0 -0
  109. package/test/data/sub//360/237/230/216 +0 -0
  110. package/test/integration/bee-class.browser.spec.ts +0 -272
  111. package/test/integration/bee-class.spec.ts +0 -631
  112. package/test/integration/bee-debug-class.spec.ts +0 -85
  113. package/test/integration/chunk/bmt.spec.ts +0 -33
  114. package/test/integration/chunk/cac.spec.ts +0 -27
  115. package/test/integration/chunk/soc.spec.ts +0 -38
  116. package/test/integration/feed/index.spec.ts +0 -84
  117. package/test/integration/modules/bytes.spec.ts +0 -23
  118. package/test/integration/modules/bzz.spec.ts +0 -265
  119. package/test/integration/modules/chunk.spec.ts +0 -29
  120. package/test/integration/modules/debug/balance.spec.ts +0 -70
  121. package/test/integration/modules/debug/chequebook.spec.ts +0 -64
  122. package/test/integration/modules/debug/connectivity.spec.ts +0 -69
  123. package/test/integration/modules/debug/settlements.spec.ts +0 -34
  124. package/test/integration/modules/debug/states.spec.ts +0 -34
  125. package/test/integration/modules/debug/status.spec.ts +0 -65
  126. package/test/integration/modules/debug/tag.spec.ts +0 -27
  127. package/test/integration/modules/debug/transactions.spec.ts +0 -10
  128. package/test/integration/modules/feed.spec.ts +0 -61
  129. package/test/integration/modules/pinning.spec.ts +0 -155
  130. package/test/integration/modules/pss.spec.ts +0 -97
  131. package/test/integration/modules/status.spec.ts +0 -10
  132. package/test/integration/modules/stewardship.spec.ts +0 -32
  133. package/test/integration/modules/tag.spec.ts +0 -51
  134. package/test/test-type-sequencer.js +0 -36
  135. package/test/testpage/testpage.html +0 -20
  136. package/test/tests-setup.ts +0 -94
  137. package/test/unit/assertions.ts +0 -460
  138. package/test/unit/bee-class.spec.ts +0 -976
  139. package/test/unit/bee-debug-class.spec.ts +0 -435
  140. package/test/unit/chunk/bmt.spec.ts +0 -16
  141. package/test/unit/chunk/cac.spec.ts +0 -29
  142. package/test/unit/chunk/serialize.spec.ts +0 -24
  143. package/test/unit/chunk/signer.spec.ts +0 -140
  144. package/test/unit/chunk/soc.spec.ts +0 -25
  145. package/test/unit/chunk/span.spec.ts +0 -38
  146. package/test/unit/feed/json.spec.ts +0 -73
  147. package/test/unit/nock.ts +0 -151
  148. package/test/unit/utils/bytes.spec.ts +0 -32
  149. package/test/unit/utils/collection.spec.ts +0 -22
  150. package/test/unit/utils/eth.spec.ts +0 -224
  151. package/test/unit/utils/hex.spec.ts +0 -115
  152. package/test/unit/utils/stream.spec.ts +0 -30
  153. package/test/unit/utils/type.spec.ts +0 -32
  154. package/test/unit/utils/uint64.spec.ts +0 -102
  155. package/test/utils.ts +0 -328
  156. package/tsconfig.json +0 -18
  157. package/tsconfig.test.json +0 -11
  158. package/typedoc.json +0 -7
  159. package/webpack.config.ts +0 -141
@@ -1,20 +0,0 @@
1
- # After new release is published on github, publish it to npmjs
2
- name: Publish on npmjs
3
-
4
- on:
5
- release:
6
- types: [published]
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v2
13
- - uses: actions/setup-node@v1
14
- with:
15
- node-version: 14
16
- registry-url: 'https://registry.npmjs.org'
17
- - run: npm ci
18
- - run: npm publish --access public
19
- env:
20
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@@ -1,20 +0,0 @@
1
- # On each new commit to master, create/update a PR with release
2
- # automatically bumps version and creates changelog as per conventional commits
3
- name: Release Github
4
-
5
- on:
6
- push:
7
- branches:
8
- - master
9
-
10
- jobs:
11
- release-please:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: GoogleCloudPlatform/release-please-action@v2
15
- id: release
16
- with:
17
- token: ${{ secrets.REPO_GHA_PAT }}
18
- release-type: node
19
- package-name: bee-js
20
- bump-minor-pre-major: true
@@ -1,128 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - 'master'
7
- pull_request:
8
- branches:
9
- - '**'
10
-
11
- env:
12
- BEE_VERSION: '1.1.0-stateful'
13
- BLOCKCHAIN_VERSION: '1.2.0-for-1.1.0-stateful'
14
- BEE_ENV_PREFIX: 'swarm-test'
15
- BEE_IMAGE_PREFIX: 'docker.pkg.github.com/ethersphere/bee-factory'
16
- COMMIT_VERSION_TAG: 'false'
17
- WORKERS: 4
18
- BEE_API_URL: 'http://localhost:1633'
19
- BEE_PEER_API_URL: 'http://localhost:11633'
20
- BEE_DEBUG_API_URL: 'http://localhost:1635'
21
- BEE_PEER_DEBUG_API_URL: 'http://localhost:11635'
22
- BEE_TEST_CHEQUEBOOK: true
23
-
24
- jobs:
25
- nodejs:
26
- runs-on: ubuntu-latest
27
-
28
- strategy:
29
- matrix:
30
- node-version: [12.x, 14.x, 16.x]
31
-
32
- steps:
33
- - name: Checkout
34
- uses: actions/checkout@v2
35
- with:
36
- fetch-depth: 1
37
-
38
- - name: Use Node.js ${{ matrix.node-version }}
39
- uses: actions/setup-node@v1
40
- with:
41
- node-version: ${{ matrix.node-version }}
42
-
43
- - name: Auth to Github Package Docker Registry
44
- run: |
45
- echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
46
-
47
- # Setup Bee environment
48
- - name: Start Bee Factory environment
49
- run: |
50
- git clone --depth=1 https://github.com/ethersphere/bee-factory.git
51
- chmod +x -R ./bee-factory/scripts
52
- ./bee-factory/scripts/environment.sh start --detach --workers=$WORKERS
53
-
54
- ## Try getting the node modules from cache, if failed npm ci
55
- - uses: actions/cache@v2
56
- id: cache-npm
57
- with:
58
- path: node_modules
59
- key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
60
- restore-keys: |
61
- ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.cache-name }}-
62
- ${{ runner.OS }}-node-${{ matrix.node }}-
63
-
64
- - name: Install npm deps
65
- if: steps.cache-npm.outputs.cache-hit != 'true'
66
- run: npm ci
67
-
68
- - name: Run unit and integration tests for node
69
- run: npm run test:node -- --detectOpenHandles
70
-
71
- - name: Debug workflow if failed
72
- if: failure()
73
- run: |
74
- KEYS=$(curl -sSf -X POST https://relay.tunshell.com/api/sessions)
75
- curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**Bee JS**\nDebug -> \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.WEBHOOK_KEY }}
76
- echo "Connect to github actions node using"
77
- echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} relay.tunshell.com"
78
- curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} relay.tunshell.com
79
-
80
- browser:
81
- runs-on: ubuntu-latest
82
-
83
- strategy:
84
- matrix:
85
- node-version: [14.x]
86
-
87
- steps:
88
- - name: Checkout
89
- uses: actions/checkout@v2
90
- with:
91
- fetch-depth: 1
92
-
93
- - name: Auth to Github Package Docker Registry
94
- run: |
95
- echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
96
-
97
- # Setup Bee environment
98
- - name: Start Bee Factory environment
99
- run: |
100
- git clone --depth=1 https://github.com/ethersphere/bee-factory.git
101
- chmod +x -R ./bee-factory/scripts
102
- ./bee-factory/scripts/environment.sh start --detach --workers=$WORKERS
103
-
104
- ## Try getting the node modules from cache, if failed npm ci
105
- - uses: actions/cache@v2
106
- id: cache-npm
107
- with:
108
- path: node_modules
109
- key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
110
- restore-keys: |
111
- ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.cache-name }}-
112
- ${{ runner.OS }}-node-${{ matrix.node }}-
113
-
114
- - name: Install npm deps
115
- if: steps.cache-npm.outputs.cache-hit != 'true'
116
- run: npm ci
117
-
118
- - name: Run browser tests
119
- run: npm run test:browser
120
-
121
- - name: Debug workflow if failed
122
- if: failure()
123
- run: |
124
- KEYS=$(curl -sSf -X POST https://relay.tunshell.com/api/sessions)
125
- curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**Bee JS**\nDebug -> \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.WEBHOOK_KEY }}
126
- echo "Connect to github actions node using"
127
- echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} relay.tunshell.com"
128
- curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} relay.tunshell.com
package/.huskyrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "hooks": {
3
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
4
- }
5
- }
package/.prettierrc DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "tabWidth": 2,
4
- "useTabs": false,
5
- "bracketSpacing": true,
6
- "semi": false,
7
- "singleQuote": true,
8
- "quoteProps": "as-needed",
9
- "trailingComma": "all",
10
- "endOfLine": "lf",
11
- "arrowParens": "avoid",
12
- "proseWrap": "always"
13
- }
@@ -1,49 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "name": "Run Jest tests",
6
- "command": "npm run test",
7
- "type": "node-terminal",
8
- "request": "launch",
9
- "env": {
10
- "NODE_ENV": "development",
11
- "BEE_API_URL": "http://localhost:1633",
12
- "BEE_DEBUG_API_URL": "http://localhost:1635",
13
- "BEE_PEER_API_URL": "http://localhost:11633",
14
- "BEE_PEER_DEBUG_API_URL": "http://localhost:11635",
15
- "BEE_TEST_CHEQUEBOOK": "true"
16
- }
17
- },
18
-
19
- {
20
- "name": "Run One Specific Node Jest test",
21
- "command": "npm run test:node -- --testPathPattern ${file}",
22
- "type": "node-terminal",
23
- "request": "launch",
24
- "env": {
25
- "NODE_ENV": "development",
26
- "BEE_API_URL": "http://localhost:1633",
27
- "BEE_DEBUG_API_URL": "http://localhost:1635",
28
- "BEE_PEER_API_URL": "http://localhost:11633",
29
- "BEE_PEER_DEBUG_API_URL": "http://localhost:11635",
30
- "BEE_TEST_CHEQUEBOOK": "true"
31
- }
32
- },
33
-
34
- {
35
- "name": "Run One Specific Browser Jest test",
36
- "command": "npm run test:browser -- --testPathPattern ${file}",
37
- "type": "node-terminal",
38
- "request": "launch",
39
- "env": {
40
- "NODE_ENV": "development",
41
- "BEE_API_URL": "http://localhost:1633",
42
- "BEE_DEBUG_API_URL": "http://localhost:1635",
43
- "BEE_PEER_API_URL": "http://localhost:11633",
44
- "BEE_PEER_DEBUG_API_URL": "http://localhost:11635",
45
- "BEE_TEST_CHEQUEBOOK": "true"
46
- }
47
- }
48
- ]
49
- }
@@ -1,39 +0,0 @@
1
- {
2
- "editor.codeActionsOnSave": {
3
- // For ESLint
4
- "source.fixAll.eslint": true,
5
- // For TSLint
6
- "source.fixAll.tslint": true,
7
- // For Stylelint
8
- "source.fixAll.stylelint": true
9
- },
10
- "eslint.validate": ["javascript", "typescript"],
11
- "editor.formatOnSave": true,
12
- "[javascript]": {
13
- "editor.formatOnSave": false
14
- },
15
- "[typescript]": {
16
- "editor.defaultFormatter": "dbaeumer.vscode-eslint",
17
- "editor.codeActionsOnSave": {
18
- "source.fixAll.eslint": true
19
- },
20
- "editor.formatOnSave": true
21
- },
22
- "[json]": {
23
- "editor.defaultFormatter": "esbenp.prettier-vscode",
24
- "editor.codeActionsOnSave": {
25
- "source.fixAll.eslint": true
26
- },
27
- "editor.formatOnSave": true
28
- },
29
- "[markdown]": {
30
- "editor.formatOnSave": false
31
- },
32
- "search.exclude": {
33
- "**/node_modules": true,
34
- "**/dist": true,
35
- "**/coverage": true
36
- },
37
- "typescript.referencesCodeLens.enabled": true,
38
- "jest.runAllTestsFirst": false
39
- }
package/CODEOWNERS DELETED
@@ -1 +0,0 @@
1
- * @nugaon @auhau
@@ -1,76 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to make participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies within all project spaces, and it also applies when
49
- an individual is representing the project or its community in public spaces.
50
- Examples of representing a project or community include using an official
51
- project e-mail address, posting via an official social media account, or acting
52
- as an appointed representative at an online or offline event. Representation of
53
- a project may be further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at info@ethswarm.org. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
-
73
- [homepage]: https://www.contributor-covenant.org
74
-
75
- For answers to common questions about this code of conduct, see
76
- https://www.contributor-covenant.org/faq
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@commitlint/config-conventional'],
3
- }
@@ -1,4 +0,0 @@
1
- import type { BatchId, Ky, NumberString, PostageBatch, PostageBatchOptions } from '../types';
2
- export declare function getAllPostageBatches(ky: Ky): Promise<PostageBatch[]>;
3
- export declare function getPostageBatch(ky: Ky, postageBatchId: BatchId): Promise<PostageBatch>;
4
- export declare function createPostageBatch(ky: Ky, amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- launch: {
3
- dumpio: true, // Forwards browser console into test console for easier debugging
4
- },
5
- }
package/jest.config.ts DELETED
@@ -1,85 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/en/configuration.html
4
- */
5
- import type { Config } from '@jest/types'
6
- import { glob } from 'glob'
7
- import * as Path from 'path'
8
-
9
- export async function getBrowserPathMapping(): Promise<{ [aliasNodeReference: string]: string }> {
10
- const browserSourceFiles = await new Promise<{ [aliasNodeReference: string]: string }>((resolve, reject) => {
11
- glob('src/**/*.browser.ts', (err, browserSourceCodes) => {
12
- if (err) reject(err)
13
- browserSourceCodes = browserSourceCodes.map(match => Path.resolve(__dirname, match))
14
- const codePathMapping: { [nodeFullPath: string]: string } = {}
15
- browserSourceCodes.map(browserFullPath => {
16
- const filePathArray = browserFullPath.split('.')
17
- filePathArray.pop()
18
- filePathArray.pop() //remove 'browser.ts' from '**/*.browser.ts'
19
- const nodeFullPath = filePathArray.join('.')
20
- const aliasNodeReference = `/${nodeFullPath.split('/').pop()}$` //keep the last bit of node file referencing e.g. '/file-source$'
21
-
22
- codePathMapping[aliasNodeReference] = browserFullPath
23
- })
24
-
25
- resolve(codePathMapping)
26
- })
27
- })
28
-
29
- return browserSourceFiles
30
- }
31
-
32
- export default async (): Promise<Config.InitialOptions> => {
33
- return {
34
- // Indicates whether the coverage information should be collected while executing the test
35
- // collectCoverage: false,
36
-
37
- // This will setup the prerequisites for the tests to run
38
- globalSetup: './tests-setup.ts',
39
-
40
- // The directory where Jest should output its coverage files
41
- coverageDirectory: 'coverage',
42
-
43
- // Custom sequencer that priorities running unit tests before integration tests
44
- testSequencer: '<rootDir>/test-type-sequencer.js',
45
-
46
- // An array of regexp pattern strings used to skip coverage collection
47
- coveragePathIgnorePatterns: ['/node_modules/'],
48
-
49
- // An array of directory names to be searched recursively up from the requiring module's location
50
- moduleDirectories: ['node_modules'],
51
-
52
- // Run tests from one or more projects
53
- projects: [
54
- // We don't have any DOM specific tests atm.
55
- // {
56
- // displayName: 'dom:unit',
57
- // testRegex: 'test/unit/.*\\.browser\\.spec\\.ts',
58
- // moduleNameMapper: await getBrowserPathMapping(),
59
- // preset: 'jest-puppeteer',
60
- // },
61
- {
62
- displayName: 'node:unit',
63
- testEnvironment: 'node',
64
- testRegex: 'test/unit/((?!\\.browser).)*\\.spec\\.ts',
65
- },
66
- {
67
- displayName: 'dom:integration',
68
- testRegex: 'test/integration/.*\\.browser\\.spec\\.ts',
69
- moduleNameMapper: await getBrowserPathMapping(),
70
- preset: 'jest-puppeteer',
71
- },
72
- {
73
- displayName: 'node:integration',
74
- testEnvironment: 'node',
75
- testRegex: 'test/integration/((?!\\.browser).)*\\.spec\\.ts',
76
- },
77
- ] as unknown[] as string[], // bad types
78
-
79
- // The root directory that Jest should scan for tests and modules within
80
- rootDir: 'test',
81
-
82
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
83
- testPathIgnorePatterns: ['/node_modules/'],
84
- }
85
- }