From 98582b2923448810f8af19db602ba1c3fee2fd75 Mon Sep 17 00:00:00 2001 From: Jayden Seric Date: Sat, 27 Oct 2018 14:24:18 +1100 Subject: [PATCH] Test the library with undefined and production NODE_ENV. --- changelog.md | 1 + package.json | 7 ++++--- src/test.mjs | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 2eda4e7..78277bc 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ ### Patch - Remove redundant uses of `this` in the internal `GraphQLQuery` component constructor. +- Test the library with undefined and production `NODE_ENV`. ## 4.0.0 diff --git a/package.json b/package.json index 281592b..2026a34 100644 --- a/package.json +++ b/package.json @@ -84,12 +84,13 @@ "prepare:js": "babel src -d lib", "prepare:jsdoc": "jsdoc-md", "prepare:prettier": "prettier 'lib/**/*.{mjs,js}' readme.md --write", - "test": "npm run test:eslint && npm run test:prettier && npm run test:size && npm run test:mjs && npm run test:js", + "test": "npm run test:eslint && npm run test:prettier && npm run test:lib && NODE_ENV=production npm run test:lib", "test:eslint": "eslint . --ext mjs,js", "test:prettier": "prettier '**/*.{json,yml,md}' -l", "test:size": "size-limit", - "test:mjs": "node --experimental-modules --no-warnings lib/test | tap-mocha-reporter spec", - "test:js": "node lib/test | tap-mocha-reporter spec", + "test:lib": "npm run test:lib:mjs && npm run test:lib:js", + "test:lib:mjs": "node --experimental-modules --no-warnings lib/test | tap-mocha-reporter spec", + "test:lib:js": "node lib/test | tap-mocha-reporter spec", "prepublishOnly": "npm run prepare && npm test", "watch": "watch 'npm run prepublishOnly --silent' src --interval 1" }, diff --git a/src/test.mjs b/src/test.mjs index 572213e..78cfa4a 100644 --- a/src/test.mjs +++ b/src/test.mjs @@ -9,6 +9,13 @@ import reactDom from 'react-dom/server' import t from 'tap' import { GraphQL, Provider, Query, preload } from '.' +// eslint-disable-next-line no-console +console.log( + `Testing ${ + process.execArgv.includes('--experimental-modules') ? 'ESM' : 'CJS' + } library with ${process.env.NODE_ENV} NODE_ENV…\n\n` +) + const EPOCH_QUERY = /* GraphQL */ ` { epoch {