From b0e7c97896f18ededad504159ae1ce4003b36c8e Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Fri, 24 Apr 2020 11:48:58 +0200 Subject: [PATCH] test: add test for Node.js ES Modules and CommonJS usage Also remove unused npm script for browser-esmodules --- .github/workflows/ci.yml | 2 ++ package.json | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47a71bd2..342840f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,3 +38,5 @@ jobs: if: matrix.node-version == '12.x' env: BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }} + - run: npm run test:node + if: matrix.node-version == '12.x' || matrix.node-version == '14.x' diff --git a/package.json b/package.json index 54937a64..192a77bd 100644 --- a/package.json +++ b/package.json @@ -72,16 +72,19 @@ "standard-version": "7.1.0" }, "scripts": { - "examples:browser-webpack:build": "cd examples/browser-webpack && npm install && npm run build", - "examples:browser-rollup:build": "cd examples/browser-rollup && npm install && npm run build", - "examples:browser-esmodules:build": "cd examples/browser-esmodules && npm install && npm run build", + "examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build", + "examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build", + "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test", + "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test", "lint": "npm run eslint:check && npm run prettier:check", "eslint:check": "eslint src/ test/ examples/ *.js", "eslint:fix": "eslint --fix src/ test/ examples/ *.js", "pretest": "[ -n $CI ] || npm run build", "test": "BABEL_ENV=commonjs node --throw-deprecation node_modules/.bin/jest test/unit/", - "pretest:browser": "npm run build && npm-run-all --parallel examples:**", + "pretest:browser": "npm run build && npm-run-all --parallel examples:browser:**", "test:browser": "wdio run ./wdio.conf.js", + "pretest:node": "npm run build", + "test:node": "npm-run-all --parallel examples:node:**", "prettier:check": "prettier --ignore-path .prettierignore --check '**/*.{js,jsx,json,md}'", "prettier:fix": "prettier --ignore-path .prettierignore --write '**/*.{js,jsx,json,md}'", "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json",