add simply library tests + fix umd and cjs mixup bug + simplify library paths

This commit is contained in:
mrjvs
2023-09-06 21:57:57 +02:00
parent 7b9b25acab
commit 764986abff
7 changed files with 22 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ module.exports = {
browser: true, browser: true,
}, },
extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
ignorePatterns: ['lib/*', '/*.js', '/*.ts', '/**/*.test.ts'], ignorePatterns: ['lib/*', '/*.js', '/*.ts', '/**/*.test.ts', 'test/*'],
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
project: './tsconfig.json', project: './tsconfig.json',

View File

@@ -3,17 +3,11 @@
"version": "0.0.6", "version": "0.0.6",
"description": "Package that contains all the providers of movie-web", "description": "Package that contains all the providers of movie-web",
"main": "./lib/index.umd.js", "main": "./lib/index.umd.js",
"module": "./lib/index.mjs",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"files": [ "files": [
"./lib" "./lib"
], ],
"exports": {
".": {
"import": "./lib/index.mjs",
"require": "./lib/index.umd.js",
"types": "./lib/index.d.ts"
}
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/movie-web/providers.git" "url": "git+https://github.com/movie-web/providers.git"

View File

@@ -1,7 +1,9 @@
import { AES, enc } from 'crypto-js'; import crypto from 'crypto-js';
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
const { AES, enc } = crypto;
interface StreamRes { interface StreamRes {
server: number; server: number;
sources: string; sources: string;

1
test/README.md Normal file
View File

@@ -0,0 +1 @@
This folder is only for simple library usage tests in `CJS` and `UMD`. Real unit tests are at `src/__test__`.

5
test/index.js Normal file
View File

@@ -0,0 +1,5 @@
const { makeProviders, makeStandardFetcher } = require('../lib/index.umd.js');
const providers = makeProviders({
fetcher: makeStandardFetcher(fetch),
});

5
test/index.mjs Normal file
View File

@@ -0,0 +1,5 @@
import { makeProviders, makeStandardFetcher } from '../lib/index.mjs';
const providers = makeProviders({
fetcher: makeStandardFetcher(fetch),
});

6
test/package.json Normal file
View File

@@ -0,0 +1,6 @@
{
"scripts": {
"start:umd": "node index.mjs",
"start:cjs": "node index.js"
}
}