diff --git a/.eslintrc.js b/.eslintrc.js index 524585d..7939452 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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': [ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec4bd6d..c23302f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,17 +15,20 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - + - name: Install Node.js uses: actions/setup-node@v3 with: node-version: 18 - + - name: Install packages run: npm install - + - name: Run tests run: npm run test - + + - name: Run integration tests + run: npm run build && npm run test:integration + - name: Run linting run: npm run lint diff --git a/package.json b/package.json index 994f319..5318b2e 100644 --- a/package.json +++ b/package.json @@ -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/", diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..d2acf3d --- /dev/null +++ b/tests/README.md @@ -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. diff --git a/tests/cjs/index.js b/tests/cjs/index.js new file mode 100644 index 0000000..1e36713 --- /dev/null +++ b/tests/cjs/index.js @@ -0,0 +1,2 @@ +require('../../lib/index.umd'); +console.log('import successful!'); diff --git a/tests/cjs/package.json b/tests/cjs/package.json new file mode 100644 index 0000000..48c2802 --- /dev/null +++ b/tests/cjs/package.json @@ -0,0 +1,4 @@ +{ + "main": "index.js", + "type": "commonjs" +} diff --git a/tests/esm/index.mjs b/tests/esm/index.mjs new file mode 100644 index 0000000..36e6235 --- /dev/null +++ b/tests/esm/index.mjs @@ -0,0 +1,2 @@ +import '../../lib/index.mjs'; +console.log('import successful!'); diff --git a/tests/esm/package.json b/tests/esm/package.json new file mode 100644 index 0000000..84f117c --- /dev/null +++ b/tests/esm/package.json @@ -0,0 +1,4 @@ +{ + "main": "index.mjs", + "type": "module" +}