diff --git a/test/build-errors/errors.test.js b/test/build-errors/errors.test.js index 1707ed6bd44..2ad43f87f5b 100644 --- a/test/build-errors/errors.test.js +++ b/test/build-errors/errors.test.js @@ -21,7 +21,7 @@ describe('errors', () => { const json = JSON.parse(stdout); expect(json['hash']).toBeDefined(); - expect(json['errorsCount']).toBe(1); + expect(json['errors']).toHaveLength(1); expect(json['errors'][0].message).toMatch(/Can't resolve/); }); @@ -41,10 +41,8 @@ describe('errors', () => { const json = JSON.parse(data); - console.log(json); - expect(json['hash']).toBeDefined(); - expect(json['errorsCount']).toBe(1); + expect(json['errors']).toHaveLength(1); expect(json['errors'][0].message).toMatch(/Can't resolve/); done(); diff --git a/test/build-warnings/warnings.test.js b/test/build-warnings/warnings.test.js index 88bae582c62..a9ec06fe476 100644 --- a/test/build-warnings/warnings.test.js +++ b/test/build-warnings/warnings.test.js @@ -7,6 +7,8 @@ describe('warnings', () => { it('should output by default', () => { const { stdout, exitCode } = run(__dirname); + console.log(stdout); + expect(stdout).toMatch(/WARNING in/); expect(stdout).toMatch(/Error: Can't resolve/); expect(exitCode).toBe(0); @@ -21,14 +23,13 @@ describe('warnings', () => { const json = JSON.parse(stdout); expect(json['hash']).toBeDefined(); - expect(json['warningsCount']).toBe(1); + expect(json['warnings']).toHaveLength(1); expect(json['warnings'][0].message).toMatch(/Can't resolve/); }); it('should store json to a file', (done) => { const { stdout, exitCode } = run(__dirname, ['--json', 'stats.json']); - console.log(stdout); expect(stdout).toContain('stats are successfully stored as json to stats.json'); expect(exitCode).toBe(0); @@ -43,7 +44,7 @@ describe('warnings', () => { const json = JSON.parse(data); expect(json['hash']).toBeDefined(); - expect(json['warningsCount']).toBe(1); + expect(json['warnings']).toHaveLength(1); expect(json['warnings'][0].message).toMatch(/Can't resolve/); done();