Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-30 21:11:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-30 21:11:31 +0300
commitc753fd0bf4a5cc09f69941daef0f6fe99d61f20e (patch)
tree9aee7f1af879446f226d7a67c149c817ace3f69f /storybook
parenteaec42f9e37fe51f9c53fa7079639ec9f4c40efc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'storybook')
-rw-r--r--storybook/config/main.js3
-rw-r--r--storybook/config/preview.js7
-rw-r--r--storybook/config/webpack.config.js21
-rw-r--r--storybook/package.json4
-rw-r--r--storybook/yarn.lock17
5 files changed, 46 insertions, 6 deletions
diff --git a/storybook/config/main.js b/storybook/config/main.js
index c1369aebd91..59aa9deb3b5 100644
--- a/storybook/config/main.js
+++ b/storybook/config/main.js
@@ -1,4 +1,3 @@
-/* eslint-disable import/no-commonjs */
const IS_EE = require('../../config/helpers/is_ee_env');
module.exports = {
@@ -6,5 +5,5 @@ module.exports = {
'../../app/assets/javascripts/**/*.stories.js',
IS_EE && '../../ee/app/assets/javascripts/**/*.stories.js',
].filter(Boolean),
- addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
+ addons: ['@storybook/addon-essentials', '@storybook/addon-a11y', 'storybook-mirage'],
};
diff --git a/storybook/config/preview.js b/storybook/config/preview.js
index 4f496665de6..a55d0d52a0c 100644
--- a/storybook/config/preview.js
+++ b/storybook/config/preview.js
@@ -1,6 +1,7 @@
-// eslint-disable-next-line import/no-extraneous-dependencies
+import { withServer } from 'storybook-mirage'; // eslint-disable-line import/no-unresolved
import Vue from 'vue';
-import translateMixin from '../../app/assets/javascripts/vue_shared/translate';
+import { createMockServer } from 'test_helpers/mock_server';
+import translateMixin from '~/vue_shared/translate';
const stylesheetsRequireCtx = require.context(
'../../app/assets/stylesheets',
@@ -13,3 +14,5 @@ translateMixin(Vue);
stylesheetsRequireCtx('./application.scss');
stylesheetsRequireCtx('./application_utilities.scss');
+
+export const decorators = [withServer(createMockServer)];
diff --git a/storybook/config/webpack.config.js b/storybook/config/webpack.config.js
index 4382ba43f21..9d630dca970 100644
--- a/storybook/config/webpack.config.js
+++ b/storybook/config/webpack.config.js
@@ -5,6 +5,7 @@ const path = require('path');
const sass = require('node-sass'); // eslint-disable-line import/no-unresolved
const { buildIncludePaths, resolveGlobUrl } = require('node-sass-magic-importer/dist/toolbox'); // eslint-disable-line import/no-unresolved
const webpack = require('webpack');
+const IS_EE = require('../../config/helpers/is_ee_env');
const IS_JH = require('../../config/helpers/is_jh_env');
const gitlabWebpackConfig = require('../../config/webpack.config');
@@ -98,13 +99,31 @@ module.exports = function storybookWebpackConfig({ config }) {
},
],
},
+ {
+ test: /\.(graphql|gql)$/,
+ exclude: /node_modules/,
+ loader: 'graphql-tag/loader',
+ },
+ {
+ test: /\.(zip)$/,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ },
];
// Silence webpack warnings about moment/pikaday not being able to resolve.
config.plugins.push(new webpack.IgnorePlugin(/moment/, /pikaday/));
+ const baseIntegrationTestHelpersPath = 'spec/frontend_integration/test_helpers';
+
// Add any missing aliases from the main GitLab webpack config
- Object.assign(config.resolve.alias, gitlabWebpackConfig.resolve.alias);
+ Object.assign(config.resolve.alias, gitlabWebpackConfig.resolve.alias, {
+ test_helpers: path.resolve(ROOT, baseIntegrationTestHelpersPath),
+ ee_else_ce_test_helpers: path.resolve(ROOT, IS_EE ? 'ee' : '', baseIntegrationTestHelpersPath),
+ test_fixtures: path.resolve(ROOT, 'tmp/tests/frontend', IS_EE ? 'fixtures-ee' : 'fixtures'),
+ });
// The main GitLab project aliases this `icons.svg` file to app/assets/javascripts/lib/utils/icons_path.js,
// which depends on the existence of a global `gon` variable.
// By deleting the alias, imports of this path will resolve as expected.
diff --git a/storybook/package.json b/storybook/package.json
index 4b922a4776c..48083ed1ce3 100644
--- a/storybook/package.json
+++ b/storybook/package.json
@@ -14,9 +14,11 @@
"@storybook/addon-controls": "^6.2.9",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/vue": "6.2.9",
+ "graphql-tag": "^2.12.5",
"node-sass": "^4.14.1",
"node-sass-magic-importer": "^5.3.2",
"postcss-loader": "3.0.0",
- "sass-loader": "^7.1.0"
+ "sass-loader": "^7.1.0",
+ "storybook-mirage": "^0.0.4"
}
}
diff --git a/storybook/yarn.lock b/storybook/yarn.lock
index de00d3bcfc2..d63618ebc65 100644
--- a/storybook/yarn.lock
+++ b/storybook/yarn.lock
@@ -5388,6 +5388,13 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==
+graphql-tag@^2.12.5:
+ version "2.12.5"
+ resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.5.tgz#5cff974a67b417747d05c8d9f5f3cb4495d0db8f"
+ integrity sha512-5xNhP4063d16Pz3HBtKprutsPrmHZi5IdUGOWRxA2B6VF7BIRGOHZ5WQvDmJXZuPcBg7rYwaFxvQYjqkSdR3TQ==
+ dependencies:
+ tslib "^2.1.0"
+
gud@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0"
@@ -9546,6 +9553,11 @@ store2@^2.12.0:
resolved "https://registry.yarnpkg.com/store2/-/store2-2.12.0.tgz#e1f1b7e1a59b6083b2596a8d067f6ee88fd4d3cf"
integrity sha512-7t+/wpKLanLzSnQPX8WAcuLCCeuSHoWdQuh9SB3xD0kNOM38DNf+0Oa+wmvxmYueRzkmh6IcdKFtvTa+ecgPDw==
+storybook-mirage@^0.0.4:
+ version "0.0.4"
+ resolved "https://registry.yarnpkg.com/storybook-mirage/-/storybook-mirage-0.0.4.tgz#572e5d310ad8f0dd963e5c341aa2402f8ed07749"
+ integrity sha512-oGjsxyxmedXQtsVW1DDwKM1RocAD5zClFeOFtAhK46NcGXLJ31m2WQg5kL7YqrsriorrCZq4vvSy05DVCD7BKQ==
+
stream-browserify@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"
@@ -10057,6 +10069,11 @@ tslib@^2.0.1, tslib@^2.0.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
+tslib@^2.1.0:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
+ integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
+
tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"