Skip to content

Commit

Permalink
CHORE type module (#5074)
Browse files Browse the repository at this point in the history
* CHORE type module

* CHORE

* CHORE

* FIX build

* FIX

* cHORE

* FIX typecheck

* CHORE

* CHORE

* FIX typing tests

* CHORE

* CHORE

* CHORE

* CHORE

* CHORE

* ADD stuff

* FIX typings test

* FIX lint

* REMOVE deps

* ADD deno test

* FIX

* FIX

* FIX imports

* FIX test

* FIX test

* FIX browser tests

* FIX loki test

* FIX testes

* FIX root import

* FIX newline

* FIX karma test

* FIX lint

* FIX

* FIX build

* FIX perf tests

* FIX test

* FIX stuff

* FIX deno tests

* FIX require

* FIX loki

* FIX

* FIX deno

* FIX landingpage build

* ADD side effects false

* FIX deno

* FIX async storage init

* FIX init

* FIX deno tests

* FIX deno tests

* FIX empty tests

* ADD deno performance tests

* FIX types

* FIX test

* FIX

* FIX tests

* FIX tests

* FIX ci

* FIX ci order

* FIX test

* FIX init

* FIX lint

* FIX deno tests
  • Loading branch information
pubkey authored Oct 12, 2023
1 parent b11c1d4 commit 29e5daa
Show file tree
Hide file tree
Showing 253 changed files with 2,154 additions and 1,952 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test_tmp/
tmp/
dist/
package.json
plugins/
examples/angular
examples/electron
examples/electron-remote
Expand Down
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"extraFileExtensions": [
".json"
],
"ecmaVersion": 2018,
"ecmaVersion": 2022,
"sourceType": "module",
"project": "./tsconfig.lint.json"
},
Expand All @@ -30,6 +30,10 @@
"@typescript-eslint/no-redundant-type-constituents": "off",

"@typescript-eslint/consistent-type-definitions": "off",
// "import/extensions": [
// "error",
// "always"
// ],
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
Expand Down Expand Up @@ -167,7 +171,6 @@
"no-prototype-builtins": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",

"@typescript-eslint/no-unused-vars": [
"error",
{
Expand All @@ -194,8 +197,6 @@
"prefer-spread": "off",
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/prefer-regexp-exec": "off",


// These rules must stay turned off
// because the take too long to run.
// Use 'npm run lint:debug:time' to check
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ jobs:

storage-mongodb:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: Set node version
Expand Down Expand Up @@ -778,18 +778,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: prepare RxDB core
run: |
npm install
npm run build
- run: npm run test:bun:dexie
- run: npm run test:performance:memory:bun

- run: npm run test:replication-couchdb
- run: npm run test:replication-firestore
- name: nats replication
Expand All @@ -799,6 +793,21 @@ jobs:
docker pull nats:2.9.17
npm run test:replication-nats
# bun
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: npm run test:bun:dexie
- run: npm run test:performance:memory:bun

# deno (must be last because it messes up with file permissions)
- uses: denoland/setup-deno@v1
with:
deno-version: "1.37.1"
- run: npm run test:deno:dexie
# TODO fix deno performance test
#- run: npm run test:performance:memory:deno

# I found out that people are stupid and use the npm downloads count
# to measure the quality of an open source project.
# But this is a bad metric so I destroy it by obfuscating the actual download count.
Expand Down
2 changes: 2 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let presets = [
[
'@babel/typescript',
{
rewriteImportExtensions: true,
loose: true,
modules: false
}
Expand All @@ -35,6 +36,7 @@ if (process.env['NODE_ENV'] === 'es5') {
[
'@babel/typescript',
{
rewriteImportExtensions: true,
loose: true,
targets: {
edge: '107',
Expand Down
9 changes: 0 additions & 9 deletions config/.mocharc.js → config/.mocharc.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
'use strict';

const mochaSettings = {
bail: true,
timeout: 10000,
exit: true,
reporter: 'spec'
};

if (process.env.TRAVIS) {
// this is so high because travis has different machines
// that are randomly slow
mochaSettings.timeout = 120 * 1000;
mochaSettings.reporter = 'min';
}

if (process.env.NODE_PROF) {
console.log('profiler activated:');
mochaSettings.prof = true;
Expand Down
4 changes: 2 additions & 2 deletions config/bundle-size.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
createRxDatabase
} from '../';
} from '../plugins/core/index.mjs';
import {
getRxStorageMemory,
} from '../plugins/storage-memory';
} from '../plugins/storage-memory/index.mjs';

function run() {
createRxDatabase({
Expand Down
131 changes: 131 additions & 0 deletions config/karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@




module.exports = async function (config) {


// while the karma tests run, we need some things which we start here
const { startTestServers, TEST_STATIC_FILE_SERVER_PORT } = await import('../test_tmp/helper/test-servers.js');
startTestServers();

const webpackConfig = await import('./karma.webpack.conf.cjs');

// karma config
const configuration = {
basePath: '',
frameworks: [
'mocha',
'webpack',
'detectBrowsers'
],
webpack: webpackConfig.default,
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'../test_tmp/unit.test.js': ['webpack', 'sourcemap']
},
files: [
'../test_tmp/unit.test.js'
],
port: 9876,
colors: true,
autoWatch: false,

/**
* Serve these static files from the same port
* so we can use it to server web-workers and stuff
* and access them with same-origin-restricted code.
*/
proxies: {
'/files': 'http://localhost:' + TEST_STATIC_FILE_SERVER_PORT + '/files'
},
/**
* see
* @link https://github.com/litixsoft/karma-detect-browsers
*/
detectBrowsers: {
enabled: true,
usePhantomJS: false,
postDetection: function (availableBrowser) {
// respect cli args overwrites
const indexOfBrowsers = process.argv.indexOf('--browsers');
if (indexOfBrowsers > 0) {
return [process.argv[indexOfBrowsers + 1]];
}

// return ['Chrome'];
// return ['Firefox'];

const doNotUseTheseBrowsers = [
'PhantomJS',
'SafariTechPreview',
'FirefoxAurora',
'FirefoxNightly',
'ChromeCanary'
];
const browsers = availableBrowser
.filter(b => !doNotUseTheseBrowsers.includes(b));
return browsers;
}
},

// Karma plugins loaded
plugins: [
'karma-mocha',
'karma-webpack',
'karma-chrome-launcher',
'karma-safari-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-opera-launcher',
'karma-detect-browsers',
'karma-spec-reporter',
'karma-sourcemap-loader'
],
client: {
mocha: {
bail: true,
/**
* Yes we need a really big value here
* because the CI servers have a non-predictable
* computation power and sometimes they can be really slow.
*/
timeout: 120000
},
/**
* Pass all env variables here,
* so that they can be used in the browsers JavaScript process.
* @link https://stackoverflow.com/a/38879184
*/
env: process.env
},
browserDisconnectTimeout: 120000,
processKillTimeout: 120000,
singleRun: true,


/**
* Use this reported to fully log all test names
* which makes it easier to debug.
* @link https://github.com/tmcgee123/karma-spec-reporter
*/
reporters: ['spec']
};

if (process.env.CI) {
console.log('# Use CI settings.');
/**
* overwrite reporters-default
* So no big list will be shown at log
*/
// configuration.reporters = [];

// how many browser should be started simultaneously
configuration.concurrency = 1;
}


config.set(configuration);
};

Loading

0 comments on commit 29e5daa

Please sign in to comment.