chore: organize test files

This commit is contained in:
Igor Randjelovic
2020-12-01 19:25:29 +01:00
committed by Nathan Walker
parent 5181769328
commit 1cd6df370b
22 changed files with 339 additions and 140 deletions

View File

@@ -42,7 +42,7 @@ describe('@nativescript/webpack', () => {
lastCalled = true;
expect(config.normal).toBe(true);
});
webpack.chainWebpack(chainFnLast, { last: true });
webpack.chainWebpack(chainFnLast, { order: 10 });
const chainFnNormal = jest.fn((config) => {
config.normal = true;
@@ -55,6 +55,22 @@ describe('@nativescript/webpack', () => {
webpack.resolveChainableConfig();
});
it('prints plugin name that errored out', () => {
webpack.useConfig(false);
webpack.setCurrentPlugin('test-plugin');
const chainFn = jest.fn(() => {
throw new Error('something wrong');
});
webpack.chainWebpack(chainFn);
// should not throw
expect(() => webpack.resolveChainableConfig()).not.toThrow();
expect(
'Unable to apply chain function from: test-plugin'
).toHaveBeenWarned();
});
it('applies merge configs', () => {
const dummyEnv = { env: true };
webpack.init(dummyEnv);