From 93a83ad300577eb66bbd63bf878dfaf98db37ac1 Mon Sep 17 00:00:00 2001 From: Irene Oppo Date: Mon, 12 Jun 2023 16:34:14 +0200 Subject: [PATCH 1/3] Fix CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36f7dd7..a9bf51c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: run: | node .github/patchVersions.js cat package.json - yarn install --no-lockfile + yarn install env: GATSBY_VERSION: ${{ matrix.gatsby-version }} NODE_VERSION: ${{ matrix.node-version }} From 135e1e9d57cf8801cb7ba0b3b549895701072144 Mon Sep 17 00:00:00 2001 From: Irene Oppo Date: Tue, 13 Jun 2023 10:04:12 +0200 Subject: [PATCH 2/3] test --- errorMap.js | 69 +++++++++++++++++++++++++++++++++++++++++----------- package.json | 3 ++- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/errorMap.js b/errorMap.js index cfb7f36..18d59ea 100644 --- a/errorMap.js +++ b/errorMap.js @@ -1,15 +1,58 @@ -"use strict"; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +'use strict'; +function _typeof(obj) { + '@babel/helpers - typeof'; + return ( + (_typeof = + 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator + ? function(obj) { + return typeof obj; + } + : function(obj) { + return obj && + 'function' == typeof Symbol && + obj.constructor === Symbol && + obj !== Symbol.prototype + ? 'symbol' + : typeof obj; + }), + _typeof(obj) + ); +} +function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true, + }); + } else { + obj[key] = value; + } + return obj; +} +function _toPropertyKey(arg) { + var key = _toPrimitive(arg, 'string'); + return _typeof(key) === 'symbol' ? key : String(key); +} +function _toPrimitive(input, hint) { + if (_typeof(input) !== 'object' || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || 'default'); + if (_typeof(res) !== 'object') return res; + throw new TypeError('@@toPrimitive must return a primitive value.'); + } + return (hint === 'string' ? String : Number)(input); +} var pluginPrefix = 'gatsby-source-datocms'; - function prefixId(id) { - return "".concat(pluginPrefix, "_").concat(id); + return ''.concat(pluginPrefix, '_').concat(id); } - var ReporterLevel = { - Error: 'ERROR' + Error: 'ERROR', }; var ReporterCategory = { // Error caused by user (typically, site misconfiguration) @@ -17,23 +60,21 @@ var ReporterCategory = { // Error caused by DatoCMS plugin ("third party" relative to Gatsby Cloud) ThirdParty: 'THIRD_PARTY', // Error caused by Gatsby process - System: 'SYSTEM' + System: 'SYSTEM', }; var CODES = { - MissingAPIToken: '10000' + MissingAPIToken: '10000', }; - var ERROR_MAP = _defineProperty({}, CODES.MissingAPIToken, { text: function text(context) { return context.sourceMessage; }, level: ReporterLevel.Error, - category: ReporterCategory.User + category: ReporterCategory.User, }); - module.exports = { pluginPrefix: pluginPrefix, CODES: CODES, prefixId: prefixId, - ERROR_MAP: ERROR_MAP -}; \ No newline at end of file + ERROR_MAP: ERROR_MAP, +}; diff --git a/package.json b/package.json index 5b270be..a93dd49 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,9 @@ "build": "babel src --out-dir . --ignore __tests__", "watch": "babel -w src --out-dir . --ignore __tests__", "prepublish": "cross-env NODE_ENV=production yarn build", + "test-node-18": "yarn build && jest --forceExit --experimental_vm_modules", "test-v4": "yarn build && jest --forceExit", - "test": "yarn build && jest --forceExit --testNamePattern='^(?!tracedSVG)'" + "test": "yarn build && node --experimental-vm-modules node_modules/jest/bin/jest.js --forceExit --testNamePattern='^(?!tracedSVG)'" }, "devDependencies": { "@babel/cli": "^7.6.2", From df9adc9131cdf5e713480f88359cf3dccc7d36b7 Mon Sep 17 00:00:00 2001 From: Irene Oppo Date: Tue, 13 Jun 2023 10:07:37 +0200 Subject: [PATCH 3/3] test --- errorMap.js | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/errorMap.js b/errorMap.js index 18d59ea..769cc92 100644 --- a/errorMap.js +++ b/errorMap.js @@ -1,26 +1,6 @@ 'use strict'; -function _typeof(obj) { - '@babel/helpers - typeof'; - return ( - (_typeof = - 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator - ? function(obj) { - return typeof obj; - } - : function(obj) { - return obj && - 'function' == typeof Symbol && - obj.constructor === Symbol && - obj !== Symbol.prototype - ? 'symbol' - : typeof obj; - }), - _typeof(obj) - ); -} function _defineProperty(obj, key, value) { - key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, @@ -33,24 +13,13 @@ function _defineProperty(obj, key, value) { } return obj; } -function _toPropertyKey(arg) { - var key = _toPrimitive(arg, 'string'); - return _typeof(key) === 'symbol' ? key : String(key); -} -function _toPrimitive(input, hint) { - if (_typeof(input) !== 'object' || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || 'default'); - if (_typeof(res) !== 'object') return res; - throw new TypeError('@@toPrimitive must return a primitive value.'); - } - return (hint === 'string' ? String : Number)(input); -} + var pluginPrefix = 'gatsby-source-datocms'; + function prefixId(id) { return ''.concat(pluginPrefix, '_').concat(id); } + var ReporterLevel = { Error: 'ERROR', }; @@ -65,6 +34,7 @@ var ReporterCategory = { var CODES = { MissingAPIToken: '10000', }; + var ERROR_MAP = _defineProperty({}, CODES.MissingAPIToken, { text: function text(context) { return context.sourceMessage; @@ -72,6 +42,7 @@ var ERROR_MAP = _defineProperty({}, CODES.MissingAPIToken, { level: ReporterLevel.Error, category: ReporterCategory.User, }); + module.exports = { pluginPrefix: pluginPrefix, CODES: CODES,