1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

chore: Update test to have more stable snapshot

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-04-12 15:07:53 -04:00
parent d4e8b48b4a
commit 97dbe5038c
2 changed files with 135 additions and 232 deletions

View File

@ -1,258 +1,155 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`get-multi-export-config given maximal package.json, when creating configuration works 1`] = ` exports[`get-multi-export-config given maximal package.json, when creating configuration works 1`] = `
[ "[
{ {
"entry": { name: './index.ts',
"index": "./index.ts", entry: { index: './index.ts' },
}, target: 'node',
"externals": [ mode: 'production',
[Function], performance: { maxEntrypointSize: 100000, hints: 'error' },
[Function], resolve: { extensions: [ '.ts', '.tsx', '.js' ] },
], plugins: [
"externalsPresets": {
"node": true,
},
"mode": "production",
"module": {
"rules": [
{
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
],
},
"name": "./index.ts",
"node": {
"__dirname": true,
"__filename": true,
},
"output": {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist",
},
"performance": {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": [
MakePeerDependenciesExternalPlugin {}, MakePeerDependenciesExternalPlugin {},
ProtectFromImportingNonDependencies {}, ProtectFromImportingNonDependencies {},
ForkTsCheckerWebpackPlugin { ForkTsCheckerWebpackPlugin {
"options": { options: {
"typescript": { typescript: {
"configOverwrite": { mode: 'write-dts',
"compilerOptions": { configOverwrite: {
"declaration": true, include: [ './index.ts' ],
"declarationDir": "/some-working-directory/dist", compilerOptions: {
}, declaration: true,
"include": [ declarationDir: '/some-working-directory/dist'
"./index.ts", }
], }
}, }
"mode": "write-dts", }
}, }
},
},
], ],
"resolve": { output: {
"extensions": [ path: '/some-working-directory/dist',
".ts", filename: [Function: filename],
".tsx", libraryTarget: 'commonjs2'
".js",
],
}, },
"target": "node", externalsPresets: { node: true },
node: { __dirname: true, __filename: true },
module: { rules: [ { test: /\\.ts(x)?$/, loader: 'ts-loader' } ] }
}, },
{ {
"entry": { name: './some-entrypoint/index.ts',
"index": "./some-entrypoint/index.ts", entry: { index: './some-entrypoint/index.ts' },
}, target: 'node',
"externals": [ mode: 'production',
[Function], performance: { maxEntrypointSize: 100000, hints: 'error' },
[Function], resolve: { extensions: [ '.ts', '.tsx', '.js' ] },
], plugins: [
"externalsPresets": {
"node": true,
},
"mode": "production",
"module": {
"rules": [
{
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
],
},
"name": "./some-entrypoint/index.ts",
"node": {
"__dirname": true,
"__filename": true,
},
"output": {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist/some-entrypoint",
},
"performance": {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": [
MakePeerDependenciesExternalPlugin {}, MakePeerDependenciesExternalPlugin {},
ProtectFromImportingNonDependencies {}, ProtectFromImportingNonDependencies {},
ForkTsCheckerWebpackPlugin { ForkTsCheckerWebpackPlugin {
"options": { options: {
"typescript": { typescript: {
"configOverwrite": { mode: 'write-dts',
"compilerOptions": { configOverwrite: {
"declaration": true, include: [ './some-entrypoint/index.ts' ],
"declarationDir": "/some-working-directory/dist/some-entrypoint", compilerOptions: {
}, declaration: true,
"include": [ declarationDir: '/some-working-directory/dist/some-entrypoint'
"./some-entrypoint/index.ts", }
], }
}, }
"mode": "write-dts", }
}, }
},
},
], ],
"resolve": { output: {
"extensions": [ path: '/some-working-directory/dist/some-entrypoint',
".ts", filename: [Function: filename],
".tsx", libraryTarget: 'commonjs2'
".js",
],
}, },
"target": "node", externalsPresets: { node: true },
node: { __dirname: true, __filename: true },
module: { rules: [ { test: /\\.ts(x)?$/, loader: 'ts-loader' } ] }
}, },
{ {
"entry": { name: './some-other-entrypoint/index.ts',
"index": "./some-other-entrypoint/index.ts", entry: { index: './some-other-entrypoint/index.ts' },
}, target: 'node',
"externals": [ mode: 'production',
[Function], performance: { maxEntrypointSize: 100000, hints: 'error' },
[Function], resolve: { extensions: [ '.ts', '.tsx', '.js' ] },
], plugins: [
"externalsPresets": {
"node": true,
},
"mode": "production",
"module": {
"rules": [
{
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
{
"test": /\\\\\\.s\\?css\\$/,
"use": [
{
"some": "miniCssExtractPluginLoader",
},
{
"loader": "css-loader",
"options": {
"modules": {
"auto": /\\\\\\.module\\\\\\./i,
"localIdentName": "[name]__[local]--[hash:base64:5]",
"mode": "local",
},
"sourceMap": false,
},
},
{
"loader": "postcss-loader",
"options": Object {
"postcssOptions": Object {
"plugins": Array [
"tailwindcss",
],
},
"sourceMap": false,
},
},
{
"loader": "sass-loader",
"options": {
"sourceMap": false,
},
},
],
},
Object {
"test": /\\\\\\.\\(ttf\\|eot\\|woff2\\?\\)\\$/,
"type": "asset/resource",
},
Object {
"test": /\\\\\\.svg\\$/,
"type": "asset/source",
},
Object {
"test": /\\\\\\.\\(jpg\\|png\\|ico\\)\\$/,
"type": "asset/resource",
},
],
},
"name": "./some-other-entrypoint/index.ts",
"node": {
"__dirname": true,
"__filename": true,
},
"output": {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist/some-other-entrypoint",
},
"performance": {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": [
MakePeerDependenciesExternalPlugin {}, MakePeerDependenciesExternalPlugin {},
ProtectFromImportingNonDependencies {}, ProtectFromImportingNonDependencies {},
ForkTsCheckerWebpackPlugin { ForkTsCheckerWebpackPlugin {
"options": { options: {
"typescript": { typescript: {
"configOverwrite": { mode: 'write-dts',
"compilerOptions": { configOverwrite: {
"declaration": true, include: [ './some-other-entrypoint/index.ts' ],
"declarationDir": "/some-working-directory/dist/some-other-entrypoint", compilerOptions: {
}, declaration: true,
"include": [ declarationDir: '/some-working-directory/dist/some-other-entrypoint'
"./some-other-entrypoint/index.ts", }
], }
}, }
"mode": "write-dts", }
},
},
}, },
MiniCssExtractPlugin { MiniCssExtractPlugin {
"_sortedModulesCache": WeakMap {}, _sortedModulesCache: WeakMap { <items unknown> },
"options": { options: {
"chunkFilename": "[name].css", filename: '[name].css',
"experimentalUseImportModule": undefined, ignoreOrder: false,
"filename": "[name].css", experimentalUseImportModule: undefined,
"ignoreOrder": false, runtime: true,
"runtime": true, chunkFilename: '[name].css'
}, },
"runtimeOptions": { runtimeOptions: {
"attributes": undefined, insert: undefined,
"insert": undefined, linkType: 'text/css',
"linkType": "text/css", attributes: undefined
}, }
}, }
], ],
"resolve": { output: {
"extensions": [ path: '/some-working-directory/dist/some-other-entrypoint',
".ts", filename: [Function: filename],
".tsx", libraryTarget: 'commonjs2'
".js",
],
}, },
"target": "node", externalsPresets: { node: true },
}, node: { __dirname: true, __filename: true },
] module: {
rules: [
{ test: /\\.ts(x)?$/, loader: 'ts-loader' },
{
test: /\\.s?css$/,
use: [
{ some: 'miniCssExtractPluginLoader' },
{
loader: 'css-loader',
options: {
sourceMap: false,
modules: {
auto: /\\.module\\./i,
mode: 'local',
localIdentName: '[name]__[local]--[hash:base64:5]'
}
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: false,
postcssOptions: { plugins: [ 'tailwindcss' ] }
}
},
{ loader: 'sass-loader', options: { sourceMap: false } }
]
},
{ test: /\\.(ttf|eot|woff2?)$/, type: 'asset/resource' },
{ test: /\\.svg$/, type: 'asset/source' },
{ test: /\\.(jpg|png|ico)$/, type: 'asset/resource' }
]
}
}
]"
`; `;

View File

@ -1,6 +1,7 @@
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"; import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import getMultiExportConfig from "./get-multi-export-config"; import getMultiExportConfig from "./get-multi-export-config";
import path from "path"; import path from "path";
import { inspect } from "util";
const getReactConfigFor = require("./get-react-config"); const getReactConfigFor = require("./get-react-config");
const resolvePathFake = path.posix.resolve; const resolvePathFake = path.posix.resolve;
@ -66,7 +67,12 @@ describe("get-multi-export-config", () => {
}); });
it("works", () => { it("works", () => {
expect(configs).toMatchSnapshot(); expect(inspect(configs, {
colors: false,
depth: Infinity,
maxArrayLength: Infinity,
maxStringLength: Infinity,
})).toMatchSnapshot();
}); });
[ [