mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
test: update tests and snapshots
This commit is contained in:
@ -108,6 +108,16 @@ exports[`angular configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -233,6 +243,7 @@ exports[`angular configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -337,6 +348,12 @@ exports[`angular configuration for android 1`] = `
|
||||
function () { /* omitted long function */ }
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('AngularWebpackPlugin') */
|
||||
new AngularWebpackPlugin(
|
||||
{
|
||||
tsconfig: '__jest__/tsconfig.json'
|
||||
}
|
||||
)
|
||||
],
|
||||
entry: {
|
||||
@ -458,6 +475,16 @@ exports[`angular configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -583,6 +610,7 @@ exports[`angular configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -687,6 +715,12 @@ exports[`angular configuration for ios 1`] = `
|
||||
function () { /* omitted long function */ }
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('AngularWebpackPlugin') */
|
||||
new AngularWebpackPlugin(
|
||||
{
|
||||
tsconfig: '__jest__/tsconfig.json'
|
||||
}
|
||||
)
|
||||
],
|
||||
entry: {
|
||||
@ -700,3 +734,26 @@ exports[`angular configuration for ios 1`] = `
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`angular configuration loads polyfills.android.ts into the bundle entry if it exists 1`] = `
|
||||
Array [
|
||||
"__jest__/src/polyfills.android.ts",
|
||||
"__jest__/src/app.js",
|
||||
"@nativescript/core/ui/frame",
|
||||
"@nativescript/core/ui/frame/activity",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`angular configuration loads polyfills.ios.ts into the bundle entry if it exists 1`] = `
|
||||
Array [
|
||||
"__jest__/src/polyfills.ios.ts",
|
||||
"__jest__/src/app.js",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`angular configuration loads polyfills.ts into the bundle entry if it exists 1`] = `
|
||||
Array [
|
||||
"__jest__/src/polyfills.ts",
|
||||
"__jest__/src/app.js",
|
||||
]
|
||||
`;
|
||||
|
@ -123,6 +123,16 @@ exports[`base configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -180,6 +190,7 @@ exports[`base configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -422,6 +433,16 @@ exports[`base configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -479,6 +500,7 @@ exports[`base configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -123,6 +123,16 @@ exports[`javascript configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -177,16 +187,6 @@ exports[`javascript configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('hmr-core') */
|
||||
{
|
||||
test: /\\\\.js$/,
|
||||
@ -207,6 +207,7 @@ exports[`javascript configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -454,6 +455,16 @@ exports[`javascript configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -508,16 +519,6 @@ exports[`javascript configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('hmr-core') */
|
||||
{
|
||||
test: /\\\\.js$/,
|
||||
@ -538,6 +539,7 @@ exports[`javascript configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -138,6 +138,16 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -195,6 +205,7 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -448,6 +459,16 @@ exports[`react configuration > android > base config 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -505,6 +526,7 @@ exports[`react configuration > android > base config 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -758,6 +780,16 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -815,6 +847,7 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -1069,6 +1102,16 @@ exports[`react configuration > ios > base config 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -1126,6 +1169,7 @@ exports[`react configuration > ios > base config 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -125,6 +125,16 @@ exports[`svelte configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -205,6 +215,7 @@ exports[`svelte configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -443,6 +454,16 @@ exports[`svelte configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -523,6 +544,7 @@ exports[`svelte configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -123,6 +123,16 @@ exports[`typescript configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -177,16 +187,6 @@ exports[`typescript configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('hmr-core') */
|
||||
{
|
||||
test: /\\\\.(js|ts)$/,
|
||||
@ -207,6 +207,7 @@ exports[`typescript configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -454,6 +455,16 @@ exports[`typescript configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -508,16 +519,6 @@ exports[`typescript configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('hmr-core') */
|
||||
{
|
||||
test: /\\\\.(js|ts)$/,
|
||||
@ -538,6 +539,7 @@ exports[`typescript configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -129,6 +129,16 @@ exports[`vue configuration for android 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -204,6 +214,7 @@ exports[`vue configuration for android 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
@ -454,6 +465,16 @@ exports[`vue configuration for ios 1`] = `
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('xml') */
|
||||
{
|
||||
test: /\\\\.xml$/,
|
||||
use: [
|
||||
/* config.module.rule('xml').use('xml-namespace-loader') */
|
||||
{
|
||||
loader: 'xml-namespace-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
/* config.module.rule('css') */
|
||||
{
|
||||
test: /\\\\.css$/,
|
||||
@ -529,6 +550,7 @@ exports[`vue configuration for ios 1`] = `
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendor: {
|
||||
|
@ -1,17 +1,20 @@
|
||||
import Config from 'webpack-chain';
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { additionalCopyRules } from '../../src/helpers/copyRules';
|
||||
import { default as angular } from '../../src/configuration/angular';
|
||||
import { init } from '../../src';
|
||||
|
||||
jest.mock(
|
||||
'@ngtools/webpack',
|
||||
() => {
|
||||
// in tests we mock both plugins so they both show up in the snapshot
|
||||
// allowing us to verify the passed configuration is correct.
|
||||
class AngularCompilerPlugin {}
|
||||
|
||||
class AngularWebpackPlugin {}
|
||||
|
||||
return {
|
||||
AngularCompilerPlugin,
|
||||
AngularWebpackPlugin,
|
||||
};
|
||||
},
|
||||
{ virtual: true }
|
||||
@ -20,6 +23,7 @@ jest.mock(
|
||||
describe('angular configuration', () => {
|
||||
const platforms = ['ios', 'android'];
|
||||
let fsExistsSyncSpy: jest.SpiedFunction<any>;
|
||||
let polyfillsPath: string | boolean = false;
|
||||
|
||||
beforeAll(() => {
|
||||
const fs = require('fs');
|
||||
@ -30,6 +34,11 @@ describe('angular configuration', () => {
|
||||
if (path === '__jest__/tsconfig.json') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (polyfillsPath && path === polyfillsPath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return original.call(fs, path);
|
||||
});
|
||||
});
|
||||
@ -45,5 +54,27 @@ describe('angular configuration', () => {
|
||||
});
|
||||
expect(angular(new Config()).toString()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it(`loads polyfills.${platform}.ts into the bundle entry if it exists `, () => {
|
||||
polyfillsPath = `__jest__/src/polyfills.${platform}.ts`;
|
||||
|
||||
init({
|
||||
[platform]: true,
|
||||
});
|
||||
expect(angular(new Config()).entry('bundle').values()).toMatchSnapshot();
|
||||
|
||||
polyfillsPath = false;
|
||||
});
|
||||
}
|
||||
|
||||
it(`loads polyfills.ts into the bundle entry if it exists `, () => {
|
||||
polyfillsPath = `__jest__/src/polyfills.ts`;
|
||||
|
||||
init({
|
||||
ios: true,
|
||||
});
|
||||
expect(angular(new Config()).entry('bundle').values()).toMatchSnapshot();
|
||||
|
||||
polyfillsPath = false;
|
||||
});
|
||||
});
|
||||
|
@ -41,7 +41,8 @@ export function addVirtualModule(
|
||||
// AngularCompilerPlugin does not support virtual modules
|
||||
// https://github.com/sysgears/webpack-virtual-modules/issues/96
|
||||
// This is only an issue on v11, which has experimental webpack 5 support
|
||||
// AngularCompilerPlugin gets replaced by AngularWebpackPlugin on v12 and i
|
||||
// AngularCompilerPlugin gets replaced by AngularWebpackPlugin on v12
|
||||
// todo: we can remove this special handling once we no longer support v11
|
||||
if (config.plugins.has('AngularCompilerPlugin')) {
|
||||
const compatEntryPath = getProjectFilePath(
|
||||
join('node_modules', '.nativescript', `${name}`)
|
||||
|
Reference in New Issue
Block a user