@@ -23,26 +23,48 @@ describe('validate options', () => {
2323 it ( `should ${
2424 type === 'success' ? 'successfully validate' : 'throw an error on'
2525 } the "${ key } " option with "${ stringifyValue ( value ) } " value`, async ( ) => {
26- const compiler = getCompiler ( 'simple.js' , { [ key ] : value } ) ;
27-
28- let stats ;
29-
30- try {
31- stats = await compile ( compiler ) ;
32- } finally {
33- if ( type === 'success' ) {
34- expect ( stats . hasErrors ( ) ) . toBe ( false ) ;
35- } else if ( type === 'failure' ) {
36- const {
37- compilation : { errors } ,
38- } = stats ;
39-
40- expect ( errors ) . toHaveLength ( 1 ) ;
41- expect ( ( ) => {
42- throw new Error ( errors [ 0 ] . error . message ) ;
43- } ) . toThrowErrorMatchingSnapshot ( ) ;
44- }
45- }
26+ // For loaders
27+ // const compiler = getCompiler('simple.js', { [key]: value });
28+ //
29+ // let stats;
30+ //
31+ // try {
32+ // stats = await compile(compiler);
33+ // } finally {
34+ // if (type === 'success') {
35+ // expect(stats.hasErrors()).toBe(false);
36+ // } else if (type === 'failure') {
37+ // const {
38+ // compilation: { errors },
39+ // } = stats;
40+ //
41+ // expect(errors).toHaveLength(1);
42+ // expect(() => {
43+ // throw new Error(errors[0].error.message);
44+ // }).toThrowErrorMatchingSnapshot();
45+ // }
46+ // }
47+ // For plugins
48+ // let error;
49+ //
50+ // try {
51+ // // eslint-disable-next-line no-new
52+ // new Plugin({ [key]: value });
53+ // } catch (errorFromPlugin) {
54+ // if (errorFromPlugin.name !== 'ValidationError') {
55+ // throw errorFromPlugin;
56+ // }
57+ //
58+ // error = errorFromPlugin;
59+ // } finally {
60+ // if (type === 'success') {
61+ // expect(error).toBeUndefined();
62+ // } else if (type === 'failure') {
63+ // expect(() => {
64+ // throw error;
65+ // }).toThrowErrorMatchingSnapshot();
66+ // }
67+ // }
4668 } ) ;
4769 }
4870
0 commit comments