Add very basic integration tests

This commit is contained in:
mrjvs 2023-09-28 19:45:41 +02:00
parent 01d56a49d0
commit 3ca04d8361
8 changed files with 25 additions and 6 deletions

View File

@ -3,7 +3,7 @@ module.exports = {
browser: true,
},
extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
ignorePatterns: ['lib/*', '/*.js', '/*.ts', '/**/*.test.ts', 'test/*'],
ignorePatterns: ['lib/*', 'tests/*', '/*.js', '/*.ts', '/**/*.test.ts', 'test/*'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
@ -33,7 +33,7 @@ module.exports = {
'no-eval': 'off',
'no-await-in-loop': 'off',
'no-nested-ternary': 'off',
'no-param-reassign': ["error", { "props": false }],
'no-param-reassign': ['error', { props: false }],
'prefer-destructuring': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'import/extensions': [

View File

@ -27,5 +27,8 @@ jobs:
- name: Run tests
run: npm run test
- name: Run integration tests
run: npm run test:integration
- name: Run linting
run: npm run lint

View File

@ -38,6 +38,7 @@
"test": "vitest run",
"test:dev": "ts-node ./src/dev-cli.ts",
"test:watch": "vitest",
"test:integration": "node ./tests/cjs && node ./tests/esm",
"test:coverage": "vitest run --coverage",
"lint": "eslint --ext .ts,.js src/",
"lint:fix": "eslint --fix --ext .ts,.js src/",

3
tests/README.md Normal file
View File

@ -0,0 +1,3 @@
# Integration test folder
This folder simply holds some import tests, to see if the library still works with all its dependencies.

2
tests/cjs/index.js Normal file
View File

@ -0,0 +1,2 @@
require('../../lib/index.umd');
console.log('import successful!');

4
tests/cjs/package.json Normal file
View File

@ -0,0 +1,4 @@
{
"main": "index.js",
"type": "commonjs"
}

2
tests/esm/index.mjs Normal file
View File

@ -0,0 +1,2 @@
import '../../lib/index.mjs';
console.log('import successful!');

4
tests/esm/package.json Normal file
View File

@ -0,0 +1,4 @@
{
"main": "index.mjs",
"type": "module"
}