diff --git a/test/colors/colors.test.js b/test/colors/colors.test.js index 6c7c52a4dd1..b89f50a4d41 100644 --- a/test/colors/colors.test.js +++ b/test/colors/colors.test.js @@ -16,6 +16,9 @@ describe('colorts', () => { it('should work with the "stats" option from flags', () => { const { stderr, stdout, exitCode } = run(__dirname, ['--stats=verbose']); + //log to check in CI + console.log('colors should be enabled by default here -'); + console.log(stdout); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); @@ -43,27 +46,28 @@ describe('colorts', () => { expect(exitCode).toBe(0); }); - it('should work with the "stats" option and --color flags', () => { - const { stderr, stdout, exitCode } = run(__dirname, ['--stats=verbose']); + it('should disable colored output with --no-color', () => { + const { stderr, stdout, exitCode } = run(__dirname, ['--stats=verbose', '--no-color']); - console.log('colors should be enabled here -'); + //log to check in CI + console.log('color should be disabled here -'); console.log(stdout); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); + expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); + expect(stdout).toContain(output); expect(exitCode).toBe(0); }); - it('should disable colored output with --no-color', () => { - const { stderr, stdout, exitCode } = run(__dirname, ['--stats=verbose', '--no-color']); + it('should work with the "stats" option and --color flags', () => { + const { stderr, stdout, exitCode } = run(__dirname, ['--stats=verbose', '--color']); //log to check in CI - console.log('color should be disabled here -'); + console.log('colors should be enabled here -'); console.log(stdout); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); - expect(stdout).toContain(output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); expect(exitCode).toBe(0); }); @@ -95,10 +99,9 @@ describe('colorts', () => { }); it('should work with the "stats" option from the configuration #3', () => { - const { stderr, stdout, exitCode } = run(__dirname, ['--config=colors-true.webpack.config.js', '--color']); + const { stderr, stdout, exitCode } = run(__dirname, ['--config=colors-true.webpack.config.js']); expect(stderr).toBeFalsy(); - console.log(stdout); const output = isWebpack5 ? 'successfully' : 'main.js'; expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); expect(exitCode).toBe(0);