Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: esm only build #772

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .babelrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
ecmaVersion: 2020,
project: './tsconfig.test.json',
},
env: {
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,22 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

# Start Bee Factory environment
- name: Start Bee Factory environment
if: matrix.node-version != '18.x'
run: npm run bee -- --verbose --detach

# Start Bee Factory environment for Node 18
- name: Start Bee Factory environment for Node 18
- name: Run unit and integration tests for node
if: matrix.node-version != '18.x'
run: npm run test:node -- --detectOpenHandles

- name: Node 18 specific Bee Factory and tests run
if: matrix.node-version == '18.x'
env:
NODE_OPTIONS: '--no-experimental-fetch'
run: npm run bee -- --verbose --detach
NODE_OPTIONS: '--no-experimental-fetch --experimental-vm-modules'
run: |
npm run bee -- --verbose --detach
npm run test:node -- --detectOpenHandles

- name: Run unit and integration tests for node
run: npm run test:node -- --detectOpenHandles

- name: Debug workflow if failed
if: failure()
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ There are also browser tests by Puppeteer, which also provide integrity testing.
npm run test:browser
```
The test HTML file which Puppeteer uses is the [test/testpage/testpage.html](test/testpage/testpage.html).
To open and manually test BeeJS with developer console, it is necessary to build the library first with `npm run compile:browser` (running the browser tests `npm run test:browser` also builds the library).
To open and manually test BeeJS with developer console, it is necessary to build the library first with `npm run build:browser` (running the browser tests `npm run test:browser` also builds the library).

#### Node 18

In order to run tests on Node 18 you have to disable the experimental Node's Udici/Fetch implementation. Use the `NODE_OPTIONS` env. variable like this:

```shell
$ export NODE_OPTIONS='--experimental-vm-modules --no-experimental-fetch'
```

### Compile code

Expand Down
27 changes: 0 additions & 27 deletions build-fixup

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions jest-puppeteer.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
launch: {
headless: !(process.env.TEST_HEADLESS === 'false'),
devtools: process.env.TEST_DEVTOOLS === 'true',
args: ['--allow-file-access-from-files'],
dumpio: true, // Forwards browser console into test console for easier debugging
},
}
5 changes: 0 additions & 5 deletions jest-puppeteer.config.js

This file was deleted.

62 changes: 62 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/en/configuration.html
*/

export default async () => {
return {
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,

// This will setup the prerequisites for the tests to run
globalSetup: './test/jest/postage-setup.js',
setupFiles: ['./test/jest/tests-setup.js'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',

// Custom sequencer that priorities running unit tests before integration tests
testSequencer: './test/jest/test-type-sequencer.js',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/'],

extensionsToTreatAsEsm: ['.ts'],

transform: {
'.ts': './test/jest/test-transformer.js',
},
// Run tests from one or more projects
projects: [
{
displayName: 'node:unit',
globalSetup: '',
testRegex: 'test/unit/((?!\\.browser).)*\\.spec\\.ts',
extensionsToTreatAsEsm: ['.ts'],
setupFiles: ['./test/jest/tests-setup.js'],
transform: {
'.ts': './test/jest/test-transformer.js',
},
},
{
displayName: 'dom:integration',
testRegex: 'test/integration/.*\\.browser\\.spec\\.ts',
preset: 'jest-puppeteer',
extensionsToTreatAsEsm: ['.ts'],
setupFiles: ['./test/jest/tests-setup.js'],
transform: {
'.ts': './test/jest/test-transformer.js',
},
},
{
displayName: 'node:integration',
testRegex: 'test/integration/((?!\\.browser).)*\\.spec\\.ts',
extensionsToTreatAsEsm: ['.ts'],
setupFiles: ['./test/jest/tests-setup.js'],
transform: {
'.ts': './test/jest/test-transformer.js',
},
},
],
}
}
85 changes: 0 additions & 85 deletions jest.config.ts

This file was deleted.

Loading